Skip to content

Fix: CRYSTAL_LOAD_DEBUG_INFO=1 fails with -Dexecution_context#15704

Merged
straight-shoota merged 1 commit intocrystal-lang:masterfrom
ysbaddaden:fix/execution-context-load-debug-info
Apr 28, 2025
Merged

Fix: CRYSTAL_LOAD_DEBUG_INFO=1 fails with -Dexecution_context#15704
straight-shoota merged 1 commit intocrystal-lang:masterfrom
ysbaddaden:fix/execution-context-load-debug-info

Conversation

@ysbaddaden
Copy link
Collaborator

Loading the debug info relies on File and goes through the event loop (even if reading files is blocking) which in turn requires a fiber scheduler (event loops are tied to a scheduler).

They used to be lazily instantiated, but with execution contexts it must be explicit. We thus have to load the debug info after creating the default execution context.

@ysbaddaden ysbaddaden added the kind:bug A bug in the code. Does not apply to documentation, specs, etc. label Apr 24, 2025
@ysbaddaden ysbaddaden self-assigned this Apr 24, 2025
@HertzDevil
Copy link
Contributor

On Windows apparently this is not early enough: ConsoleUtils.@@reader_thread creates an execution context before the default context is initialized, and then the runtime breaks because STDERR is not initialized either

@straight-shoota
Copy link
Member

I presume we should still merge this, though?

@ysbaddaden

This comment was marked as outdated.

@ysbaddaden
Copy link
Collaborator Author

ysbaddaden commented Apr 28, 2025

I don't have any issue with CRYSTAL_LOAD_DEBUG_INFO=1 on Windows with this branch. I guess we can merge this fix.

I'll propose a few changes for Windows in a separate branch (no need for the isolated context + we should control when to start the thread).

EDIT: I eventually reproduced 🤦 I'll still push a fix as explained above

@ysbaddaden ysbaddaden moved this from Review to Approved in Multi-threading Apr 28, 2025
@straight-shoota straight-shoota merged commit 2d07222 into crystal-lang:master Apr 28, 2025
36 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in Multi-threading Apr 28, 2025
@crysbot
Copy link
Collaborator

crysbot commented Apr 28, 2025

Successfully created backport PR for release/1.16:

@ysbaddaden ysbaddaden deleted the fix/execution-context-load-debug-info branch April 28, 2025 09:23
straight-shoota pushed a commit that referenced this pull request Apr 28, 2025
#15715)

Co-authored-by: Julien Portalier <julien@portalier.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport release/1.16 kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:runtime

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants