-
Notifications
You must be signed in to change notification settings - Fork 575
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
Type safety error in fiber serialisation/TLS swapping code can cause weird crashes #147
Comments
Because
That's because
Ah, but in the original use-case for serialization, there would be no next run. Once a fiber is serialized, the original fiber was presumed to be discarded until a new one is recreated from the serialized representation. It seems like fiber serialization needs to be retrofitted to allow your use-case. I don't think it's a big change by any means, but the current assumptions are wrong. |
Fiber defines the following fields:
private Object fiberLocals; private Object inheritableFiberLocals;
It is unclear to me why type safety is disabled for these fields, but it appears that normally they are meant to contain a ThreadLocalMap object, judging from Fiber.switchFiberAndThreadLocals()
However FiberSerializer changes the type of these fields with no explanation:
After this code runs f.fiberLocals is now an array, not a ThreadLocalMap. No explanation is provided in the code for the type switch. This causes a crash when debugging is enabled on the next run through switchFiberAndThreadLocals when it tries to print out the contents to the debug log.
The text was updated successfully, but these errors were encountered: