Comments (4)
Hey Malte,
thanks for investigating this! And again big thank you for supplying the OSX-makefile. Unfortunately I currently don't have an OSX-environment available, so I cannot do much on this issue. However I confirmed that it is (probably) not a clang vs gcc issue (note the new clang-makefile for linux). Building JyNI with clang on linux works fine and also the Tkinter-demo works.
Can you figure out the line (in _tkinter.c (?)) where the application is hanging?
Let's strip down the demo to a bare window:
from Tkinter import Tk
root = Tk()
root.mainloop()
print "exit"
Is this already hanging? (I suppose so)
from jyni.
So, it's time for an update in this thread. In case a reader is wondering why it took so long: Stefan and I were working in person on this problem (and others) for some time, and while JyNI is now working really well on OSX, the problem with Tkinter still stands.
As suspected by Stefan, the stripped down version of the demo already freezes on OSX.
A java process with Tk's icon shows up in the Dock, but no window is opened. One can see a window named "Tk" in the window list of the java process (accessible via a ctrl-click in the Dock), but selecting this entry crashes java with a SIGSEGV error.
We could identify the hanging function call in _tkinter.c: it's a call to Tcl_DoOneEvent(0) in line 3036.
In fact, it's always the 7th processed event that causes the freezing.
We have no idea what happens inside of Tcl_DoOneEvent and would appreciate the help of someone who is more familiar with Tk.
PS: We've also looked into OSX specific code in _tkinter.c. There's a call to Tk_MacOSXSetupTkNotifier in init_tkinter(void), protected by an #ifdef TK_AQUA, but this can't be the culprit, since TK_AQUA isn't defined in my configuration (and doing so doesn't help either).
from jyni.
I prepared the JyNI-unstable repository to debug JyNI regarding _tkinter.c (statically linking it now). I inserted debugging output in _tkinter.c (JyNI-C/src/Modules/_tkinter.c) to log every call to Tk or Tcl-API and every method call in _tkinter.c.
The test tkinter-program JyNI-Demo/src/JyNITkinterTest.py displays a bare tkinter window and I directly clicked the closing button; you can see corresponding closing events at the bottom of the log. So far I did not log Python-part of tkinter (actually wouldn't know where to start).
Malte produced the following output on OSX (hanging run):
https://dl.dropboxusercontent.com/u/50299996/tkinter_log_osx.txt
I produced this log on Linux (LMDE2) (successful run):
https://dl.dropboxusercontent.com/u/50299996/tkinter_log_linux.txt
You will note that they are identical except the OSX one stucks at some point while the linux one continues.
Running the logged tkinter with CPython 2.7.8 on Linux produces this output:
https://dl.dropboxusercontent.com/u/50299996/tkinter_log_linux-CPython2.7.txt
Only difference to JyNI-run is that it skips these calls that were present in the JyNI-log:
Tcl_AppInit (680)
683: Tcl_Init(interp)
689: Tcl_GetVar(interp, "_tkinter_skip_tk_init", TCL_GLOBAL_ONLY)
702: Tk_Init(interp)
Another thing we tried was to call Tcl_DoOneEvent(0) in line 3049 with TCL_DONT_WAIT. This crashes Java on OSX while it runs fine on Linux (with an infinit background loop though). We are currently debugging this issue (probably another uninitialized memory thing). JyNI-unstable/TCL_DONT_WAIT branch is about this topic. However I suspect the TCL_DONT_WAIT-triggered crash is a separate issue.
Any hints (how to debug the original issue) appreciated.
from jyni.
Tcl_DoOneEvent calls Tcl_WaitForEvent which is platform specific (see macosx/tclMacOSXNotify.c at
http://core.tcl.tk/tcl/artifact/c699f984689dd959 ).
You will need help from people knowing tcl and macosx internals…
from jyni.
Related Issues (20)
- Iterator support (TypeError: argument of type 'dict' is not iterable) HOT 10
- Request to explore JavaCPP as an extension to model Python FFI. HOT 4
- JyNI-C/src/Python/pythonrun.c:1956 isnt' know struct sigaction context ocontext HOT 5
- 'getset_descriptor' object is not callable at 1668:0 in defchararray.py HOT 3
- Patch: NumPy 13.2 broken for JyNI 2.7-alpha.5 HOT 1
- nltk download crashes HOT 15
- NumPy 1.14+ compatibility HOT 8
- Name JyNI.jar Mandatory HOT 15
- support for the BufferProtocol HOT 8
- SciPy HOT 1
- mmap: String access is truncated or causes NullPointerException HOT 11
- Add debug target to makefile. HOT 2
- PyExc_TypeError has ob_type == NULL HOT 25
- Under memory stress JVM builds an invalid native jobject, potentially causing segfault during GC
- When using numpy, we call np.split(x,2),np.hsplit(x,2),np.vsplit(x,2), x is a numpy array. But the command didn't output anything or report any mistakes HOT 1
- Setting JyNI to work with Processing HOT 5
- Jython 2.7.2, NumPy advice HOT 1
- Can't seem to load the co_stacksize extension
- How to correcty install and use JyNI with numpy support on Jython? HOT 2
- custom module imported but functions not exported HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jyni.