-
Notifications
You must be signed in to change notification settings - Fork 362
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
Make module loader in multithreading mode be more aware when init fails #3598
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Show meaningful error/stacktrace to users
❯ lldb ./sandbox/.3/target/scala-3.3.1/sandbox
(lldb) target create "./sandbox/.3/target/scala-3.3.1/sandbox"
Current executable set to '/Users/tanishiking/ghq/github.com/tanishiking/scala-native/sandbox/.3/target/scala-3.3.1/sandbox' (arm64).
(lldb) run
Process 93413 launched: '/Users/tanishiking/ghq/github.com/tanishiking/scala-native/sandbox/.3/target/scala-3.3.1/sandbox' (arm64)
start thread 0start thread 0start thread 3
start init by Thread[5,thread-3,5,main]
tart init by Thread[5,thread-3,5,main]d 5
start thread 2
start thread 4
start thread 6
t
tart thread 6start thread 1
start thread 7
Process 93413 stopped
* thread #7, stop reason = signal SIGBUS
frame #0: 0x00000001001c44ac sandbox`scalanative_gc_safepoint_poll at ImmixGC.c:149:20
146 MutatorThread_switchState(currentMutatorThread, state);
147 }
148 void scalanative_gc_safepoint_poll() {
-> 149 void *pollGC = *scalanative_gc_safepoint;
150 }
151
152 void scalanative_add_roots(void *addr_low, void *addr_high) {
(lldb) bt
* thread #7, stop reason = signal SIGBUS
* frame #0: 0x00000001001c44ac sandbox`scalanative_gc_safepoint_poll at ImmixGC.c:149:20
frame #1: 0x00000001001c6cd4 sandbox`waitForInitialization(slot=0x0000000100323940, classInfo=0x0000000100325d00) at module_load.cpp:94:9
frame #2: 0x00000001001c6bc4 sandbox`::__scalanative_loadModule(slot=0x0000000100323940, classInfo=0x0000000100325d00, size=24, ctor=(sandbox`_SM12Deadlocking$RE at Test.scala)) at module_load.cpp:134:16
frame #3: 0x0000000100050d20 sandbox`_SM12Deadlocking$G4load at Test.scala:1:8
frame #4: 0x0000000100050fd8 sandbox`_SM5Test$D10$anonfun$1iuEPT5Test$(n$1=5) at Test.scala:16:41 [opt]
frame #5: 0x00000001000518cc sandbox`_SM15Test$$$Lambda$4D3runuEO at Test.scala:18:10 [opt]
frame #6: 0x0000000100140780 sandbox`_SM16java.lang.ThreadD3runuEO(this=0x00000002c000e280) at Thread.scala:247:31 [opt]
frame #7: 0x000000010002bad8 sandbox`_SM39scala.scalanative.runtime.NativeThread$D16threadEntryPointL38scala.scalanative.runtime.NativeThreaduEPT39scala.scalanative.runtime.NativeThread$(this=0x0000000100321248, nativeThread=0x00000002c0040c90) at NativeThread.scala:133:19
frame #8: 0x000000010002c578 sandbox`_SM39scala.scalanative.runtime.NativeThread$D24threadRoutine$$anonfun$1L28scala.scalanative.unsafe.PtrL28scala.scalanative.unsafe.PtrEPT39scala.scalanative.runtime.NativeThread$(arg=<unavailable>) at NativeThread.scala:121:36 [opt]
frame #9: 0x000000010002c5ec sandbox`_SM49scala.scalanative.runtime.NativeThread$$$Lambda$1G17$extern$forwarder at NativeThread.scala:117:71 [opt]
frame #10: 0x00000001001c4448 sandbox`ProxyThreadStartRoutine(args=0x0000600001ac0010) at ImmixGC.c:113:5
frame #11: 0x0000000182ba7034
(lldb) fr va
(void *) pollGC = 0x00000001001c6ccc
|
Talked with @WojciechMazur. The We tried to re-throw an exception (in Scala, calling from
(My two cent: this is probably caused because the memory address for Anyway, 24d5ad0 has kind of improvement
While this will add up a bit more instructions to the generated code (return value check for every module initialization), it anyway works. We need some more improvements
Result of `sandbox3 / run`, stacktrace is a bit messy 😢
|
#3591
ctor(instance)
(inmodule_load.cpp
)InitializationContext
InitializationContext
.