-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Memory corruption with Thread on musl #8738
Comments
EDIT: NVM. |
It fails often. Either we find a fix soon or we should turn off the CI for alpine. It's getting noisy. |
Running against master with #8743 the error message is now The error seems to occur in different thread specs, I've found these locations:
It doesn't seem to be consistent. And it's not consistent whether the error occurs at all. When running only thread specs ( When running with strace (and Those are the traces:
|
To reduce noise we could temporarily disable the specs in question for musl/alpine. |
Can we at least disable the emails? Please? |
The specs have been disabled to remove noise on CI jobs (#8801). But the original issue still needs to be fixed. |
This is the stacktrace I got on a Docker image: (you will need to re-enable ASLR in the debugger first, e.g.
The thread routine may be started before module Crystal::System::Thread
private def init_handle
ret = GC.pthread_create(
thread: pointerof(@system_handle),
attr: Pointer(LibC::PthreadAttrT).null,
start: ->(data : Void*) {
# it looks like `LibC.pthread_self` isn't valid here yet?
# otherwise we could assign `th.@system_handle` at this point
th = data.as(::Thread)
until th.to_unsafe
Thread.yield_current # ???
end
th.start
Pointer(Void).null
},
arg: self.as(Void*),
)
raise RuntimeError.from_os_error("pthread_create", Errno.new(ret)) unless ret == 0
end
end With this all three thread spec files seem to never fail again. I don't know why this failure doesn't happen on other POSIX systems. The Windows |
Oh nice, great catch @HertzDevil! Maybe we can just set the handle, so both threads will set the handle, but at least we're sure the value is visible (an atomic wouldn't solve the race). thread = data.as(::Thread)
thread.@system_handle ||= LibC.pthread_self
thread.start Or maybe protected def start
@system_handle ||= Crystal::System::Thread.current_handle
# ...
end |
The test_alpine job fails in some workflows on master (Example: https://circleci.com/gh/crystal-lang/crystal/37573) but not every time (Example: https://circleci.com/gh/crystal-lang/crystal/37643).
The error happens while running stdlib specs with a newly built compiler. The error message is
Failed to raise an exception: END_OF_STACK
, so it's not clear what's the issue. I'd assume that would be improved by #8735 but on that branch the error message is identical: https://circleci.com/gh/crystal-lang/crystal/37656The text was updated successfully, but these errors were encountered: