Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flaky test #864

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/Dockerfile.buster
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/* && \
update-alternatives --set php /usr/bin/php7.4

RUN useradd -ms /bin/bash kitten
RUN useradd -ms /bin/bash kitten
4 changes: 4 additions & 0 deletions cmake/init-compilation-flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ option(ADDRESS_SANITIZER "Enable address sanitizer")
if(ADDRESS_SANITIZER)
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
if (COMPILER_GCC)
add_compile_options(-static-libasan)
add_link_options(-static-libasan)
endif()
add_definitions(-DASAN_ENABLED=1)
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type (default Debug)" FORCE)
endif()
Expand Down
12 changes: 12 additions & 0 deletions runtime/allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,15 @@ inline auto make_unique_on_script_memory(Args &&... args) noexcept {
static_assert(std::is_base_of<ManagedThroughDlAllocator, T>{}, "ManagedThroughDlAllocator should be base for T");
return std::make_unique<T>(std::forward<Args>(args)...);
}

void *operator new(size_t size) __attribute__((weak));
void *operator new(size_t size, const std::nothrow_t &) noexcept __attribute__((weak));
void *operator new[](size_t size) __attribute__((weak));
void *operator new[](size_t size, const std::nothrow_t &) noexcept __attribute__((weak));

void operator delete(void *mem) noexcept __attribute__((weak));
void operator delete(void *mem, const std::nothrow_t &) noexcept __attribute__((weak));
void operator delete[](void *mem) noexcept __attribute__((weak));
void operator delete[](void *mem, const std::nothrow_t &) noexcept __attribute__((weak));
void operator delete(void *mem, size_t) noexcept __attribute__((weak));
void operator delete[](void *mem, size_t) noexcept __attribute__((weak));
7 changes: 7 additions & 0 deletions tests/python/tests/job_workers/test_job_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ def test_job_exception_error(self):
"Error 0: Test exception"
])

def test_job_stack_overflow_error(self):
self.job_error_test_impl("stack_overflow", self.JOB_STACK_OVERFLOW_ERROR, data=[[1, 2, 3, 4, 5]], buffers=2)
self.kphp_server.assert_log([
"Critical error during script execution: sigsegv\\(stack overflow\\)",
"Error -1: Callstack overflow"
])

def test_job_php_assert_error(self):
self.job_error_test_impl("php_assert", self.JOB_PHP_ASSERT_ERROR)
self.kphp_server.assert_log(2 * [
Expand Down