bitwiseworks / libc

LIBC Next (kLIBC fork)
9 stars 4 forks source link

__spawnve can fail returning weird errno #35

Open dmik opened 5 years ago

dmik commented 5 years ago

Under heavy load (e.g. making Qt 5 with kBuild make in -j4 mode) spawnvpe run by make (ends up in __spawnve as all other exec/spawn calls) returns -1 and -4 as errno, like this:

g++ -c -Zomf -march=i686 -mtune=i686 -msse2 -mstackrealign -mfpmath=sse -g -O3 -std=c++1y -fno-exceptions -Wall -W -Wvla -Werror -Wno-error=cpp -Wno-error=deprecated-declarations -Wno-error=strict-overflow -DQT_NO_IPV6 -DQT_NO_USING_NAMESPACE -DQT_NO_FOREACH -DENABLE_PIXMAN_DRAWHELPERS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_GUI_LIB -DQT_BUILDING_QT -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_CORE_LIB -Wall -Wextra -Werror -Woverloaded-virtual -Wshadow -Wundef -Wfloat-equal -Wnon-virtual-dtor -Wpointer-arith -Wformat-security -Wno-long-long -Wno-variadic-macros -pedantic-errors -Wchar-subscripts -Wold-style-cast -Wcast-align -Wdouble-promotion -Wfloat-conversion -Wzero-as-null-pointer-constant -I~/Network/novator_D/Coding/qt5/qt5/qtbase/src/gui -I. -I../../include -I../../include/QtGui -I../../include/QtGui/5.11.0 -I../../include/QtGui/5.11.0/QtGui -I.tracegen/release -I../../include/QtCore/5.11.0 -I../../include/QtCore/5.11.0/QtCore -I../../include/QtCore -I.moc/release -isystem /@unixroot/usr/include/libpng16 -I~/Network/novator_D/Coding/qt5/qt5/qtbase/src/3rdparty/harfbuzz-ng/include -I~/Network/novator_D/Coding/qt5/qt5/qtbase/mkspecs/os2-g++ -DQT_NO_CAST_TO_ASCII=1 -DQT_NO_CAST_FROM_ASCII=1 -UQT_RESTRICTED_CAST_FROM_ASCII -DQT_STRICT_ITERATORS -DQT_NO_URL_CAST_FROM_STRING=1 -DQT_NO_CAST_FROM_BYTEARRAY=1 -DQT_NO_KEYWORDS=1 -DQT_USE_QSTRINGBUILDER -DQT_USE_FAST_OPERATOR_PLUS -Dsignals=int -Dslots=int -Demit=public: -Dforeach=public: -Dforever=public: -xc++ ~/Network/novator_D/Coding/qt5/qt5/qtbase/src/gui/painting/qtransform.h -o .obj/release/header_qtransform.obj
make[2]: execvp: g++: Unknown error -4
make[2]: spawn: Invalid argument
make[2]: Leaving directory `~/Network/novator_D/Coding/qt5/qt5-dev-build/qtbase/src/gui'
make[1]: *** [release] Error 2
make: *** [manual] Error 2
make[1]: Leaving directory `~/Network/novator_D/Coding/qt5/qt5-dev-build/qtbase/src/gui'

This is very annoying as it breaks overnight builds.

The most probable cause for this is some DosWait call in LIBC that returns ERROR_INTERRUPT because of the Posix signal implementation in LIBC (which uses DosKillThread to make the thread process signals) when delivering SIGCHLD or such. ERROR_INTERRUPT is 4 and LIBC is known to return OS/2 error codes negated.

Note that for some reason it happens more often when make is run by a shhd executable (i.e. over ssh from another computer). Running it locally, i see it very rarely. It's either timing or how sshd processes signals. Or both.