Skip to content
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

first example crashes when starting Julia with multiple threads on apple silicon #10

Closed
ericphanson opened this issue Aug 20, 2023 · 5 comments · Fixed by #23
Closed
Labels
Acknowledged We are aware of this issue and will respond soon Crash Fatal terminating Error MacOS Happens only on MacOS Temporary Fix Available There is a workaround for this issue

Comments

@ericphanson
Copy link

In [2]: versioninfo()
Julia Version 1.9.2
Commit e4ee485e909 (2023-07-05 09:39 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 8 × Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)
  Threads: 4 on 4 virtual cores
Environment:
  JULIA_NUM_THREADS = 4
  JULIA_PKG_SERVER_REGISTRY_PREFERENCE = eager

(@mousetrap) pkg> st
Status `~/.julia/environments/mousetrap/Project.toml`
  [5deeb4b9] mousetrap v0.1.0 `https://github.com/Clemapfel/mousetrap.jl#main`
  [7f2654e2] mousetrap_apple_jll v0.1.0+0 `https://github.com/Clemapfel/mousetrap_apple_jll#main`
  [b6bb2801] mousetrap_linux_jll v0.1.0+0 `https://github.com/Clemapfel/mousetrap_linux_jll#main`
  [1923bf96] mousetrap_windows_jll v0.1.0+0 `https://github.com/Clemapfel/mousetrap_windows_jll#main`

In [4]: using mousetrap

In [5]: main() do app::Application
            window = Window(app)
            set_child!(window, Label("Hello World!"))
            present!(window)
        end

(process:93174): mousetrap.jl-WARNING **: 17:33:46.903: In mousetrap.main: You are running mousetrap from within the REPL. Interactive use of mousetrap is an experimental feature, side-effects may occurr.
Out[5]: Task (runnable) @0x000000010e68a590

In [6]:
(<unknown>:93174): GLib-GIO-CRITICAL **: 17:33:47.332: g_settings_schema_source_lookup: assertion 'source != NULL' failed

(<unknown>:93174): GLib-GIO-CRITICAL **: 17:33:47.332: g_settings_schema_source_lookup: assertion 'source != NULL' failed
2023-08-20 17:33:47.392 julia[93174:85063167] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow drag regions should only be invalidated on the Main Thread!'
*** First throw call stack:
(
)
libc++abi: terminating with uncaught exception of type NSException

[93174] signal (6): Abort trap: 6
in expression starting at none:0
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
Allocations: 5301661 (Pool: 5298319; Big: 3342); GC: 8
zsh: abort      julia

If I start Julia with

JULIA_NUM_THREADS=1 julia

then the example works, although it doesn't render as nicely as in the README screenshot.
Screen Shot 2023-08-20 at 17 35 47

@Clemapfel Clemapfel added the Acknowledged We are aware of this issue and will respond soon label Aug 21, 2023
@Clemapfel
Copy link
Owner

Clemapfel commented Aug 21, 2023

Thank you, could you run the following code and tell me if it still crashes?

using mousetrap
app = Application("issue.test")
connect_signal_activate!(app) do app::Application
    window = Window(app)
    set_child!(window, Label("Test"))
    present!(window)
end
run!(app)

I will also try to reproduce this on my end

@Clemapfel Clemapfel added Crash Fatal terminating Error MacOS Happens only on MacOS labels Aug 21, 2023
@ericphanson
Copy link
Author

ericphanson commented Aug 21, 2023

Thank you, could you run the following code and tell me if it still crashes?

This doesn't crash. No window pops up though. (BTW: I added a close-paren to the line set_child!(window, Label("Test"))

@Clemapfel
Copy link
Owner

Clemapfel commented Aug 21, 2023

Yes thank you, I typo'd there, also I forgot to add run!, this is the correct code, I also edited the original message.

using mousetrap
app = Application("issue.test")
connect_signal_activate!(app) do app::Application
    window = Window(app)
    set_child!(window, Label("Test"))
    present!(window)
end
run!(app)

Which should open a window.

Does this still crash for you? I apologize for the typos, I shouldn't be answering issue on my phone.

@ericphanson
Copy link
Author

That works! It opens a window and does not crash.
Screen Shot 2023-08-22 at 00 47 53

@Clemapfel
Copy link
Owner

Okay thank you, I'm pretty sure usage of Threads.Task here is causing this then. I'll have a PR ready as soon as possible.

Until then you can just use that code snippet instead of main. Thank you for helping out!

@Clemapfel Clemapfel added the Temporary Fix Available There is a workaround for this issue label Aug 22, 2023
@Clemapfel Clemapfel linked a pull request Sep 14, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Acknowledged We are aware of this issue and will respond soon Crash Fatal terminating Error MacOS Happens only on MacOS Temporary Fix Available There is a workaround for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants