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

Multiple active Viewer objects #2

Closed
apaoluzzi opened this issue Mar 26, 2024 · 5 comments
Closed

Multiple active Viewer objects #2

apaoluzzi opened this issue Mar 26, 2024 · 5 comments
Assignees

Comments

@apaoluzzi
Copy link
Collaborator

Il would be of greater benefit to Plasm users to have more that one active Viewer objects.

Currently, only one Viewer object (1) gets control of execution, and (2) programs cannot continue until it is closed and (3) the control returns to Julia's Main process.

It would be great if (in some future release) Plasm.jl multiprocessing could open, interact, and close more that one Viewer windows, possibly under the control of Julia REPL on the terminal.

Great benefits would arise both for the julia software developer (e.g. in debug) and the designer (engineer, architect, etc.) enjoying Plasm.jl

scrgiorgio added a commit that referenced this issue Oct 22, 2024
@scrgiorgio
Copy link
Owner

Added another parameter use_thread to allow running multiple viewers in parallel.

To enable threading you MUST run julia using:

julia --project=. --threads=auto 

An example using REPL:

using Plasm
VIEW(CUBOID([1,1,1]), use_thread=true)
VIEWCOMPLEX(lar, use_thread=true)

@apaoluzzi please check and close the issus

@apaoluzzi
Copy link
Collaborator Author

The new version die on macOS Sequoia v15.0.1

The terminal script follow:

(base) ✔ ~/github.com/scrgiorgio/Plasm.jl [main|⚑ 4] 
11:32 $ julia --project=. --threads=auto 
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.10.4 (2024-06-04)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using Plasm

julia> VIEW(CUBOID([1,1,1]), use_thread=true)
Creating Window use_thread=true
Task (runnable) @0x000000016322c550

julia> VIEWCOMPLEX(lar, use_thread=true)*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSWindow should only be instantiated on the main thread!'
*** First throw call stack:
(
)
libc++abi: terminating due to uncaught exception of type NSException

[23741] signal (6): Abort trap: 6
in expression starting at none:0
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
pthread_kill at /usr/lib/system/libsystem_pthread.dylib (unknown line)
abort at /usr/lib/system/libsystem_c.dylib (unknown line)
abort_message at /usr/lib/libc++abi.dylib (unknown line)
_ZL28demangling_terminate_handlerv at /usr/lib/libc++abi.dylib (unknown line)
_ZL15_objc_terminatev at /usr/lib/libobjc.A.dylib (unknown line)
_ZSt11__terminatePFvvE at /usr/lib/libc++abi.dylib (unknown line)
_ZN10__cxxabiv1L12failed_throwEPNS_15__cxa_exceptionE at /usr/lib/libc++abi.dylib (unknown line)
__cxa_throw at /usr/lib/libc++abi.dylib (unknown line)
objc_exception_throw at /usr/lib/libobjc.A.dylib (unknown line)
-[NSException raise] at /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (unknown line)
-[NSWindow _initContent:styleMask:backing:defer:contentView:] at /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (unknown line)
-[NSWindow initWithContentRect:styleMask:backing:defer:] at /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (unknown line)
_glfwCreateWindowCocoa at /Users/paoluzzi/.julia/artifacts/893d47a4a45d1849a679fcda9ff668be0d8d3ee7/lib/libglfw.3.4.dylib (unknown line)
glfwCreateWindow at /Users/paoluzzi/.julia/artifacts/893d47a4a45d1849a679fcda9ff668be0d8d3ee7/lib/libglfw.3.4.dylib (unknown line)
CreateWindow at /Users/paoluzzi/.julia/packages/GLFW/wmoTL/src/glfw3.jl:571
CreateWindow at /Users/paoluzzi/.julia/packages/GLFW/wmoTL/src/glfw3.jl:571 [inlined]
CreateWindow at /Users/paoluzzi/.julia/packages/GLFW/wmoTL/src/glfw3.jl:571 [inlined]
#run_viewer_in_current_thread#57 at /Users/paoluzzi/github.com/scrgiorgio/Plasm.jl/src/viewer.glfw.jl:939
run_viewer_in_current_thread at /Users/paoluzzi/github.com/scrgiorgio/Plasm.jl/src/viewer.glfw.jl:887 [inlined]
#69 at /Users/paoluzzi/github.com/scrgiorgio/Plasm.jl/src/viewer.glfw.jl:997
unknown function (ip: 0x103884dbc)
_jl_invoke at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-grannysmith-C07ZM05NJYVY.0/build/default-grannysmith-C07ZM05NJYVY-0/julialang/julia-release-1-dot-10/src/gf.c:0 [inlined]
ijl_apply_generic at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-grannysmith-C07ZM05NJYVY.0/build/default-grannysmith-C07ZM05NJYVY-0/julialang/julia-release-1-dot-10/src/gf.c:3077
jl_apply at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-grannysmith-C07ZM05NJYVY.0/build/default-grannysmith-C07ZM05NJYVY-0/julialang/julia-release-1-dot-10/src/./julia.h:1982 [inlined]
start_task at /Users/julia/.julia/scratchspaces/a66863c6-20e8-4ff4-8a62-49f30b1f605e/agent-cache/default-grannysmith-C07ZM05NJYVY.0/build/default-grannysmith-C07ZM05NJYVY-0/julialang/julia-release-1-dot-10/src/task.c:1238
Allocations: 18672286 (Pool: 18643691; Big: 28595); GC: 18
Abort trap: 6
(base) ✘-ABRT ~/github.com/scrgiorgio/Plasm.jl [main|⚑ 4] 
11:33 $ 

@scrgiorgio
Copy link
Owner

it's related to MacOS. See:
JuliaGL/GLFW.jl#233
we have the latest version so we cannot fix it right now.

@scrgiorgio
Copy link
Owner

@apaoluzzi there is not much we can do about it right now. please close the issue

@apaoluzzi
Copy link
Collaborator Author

Hope we can reopen this isuue in some future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants