Giter VIP home page Giter VIP logo

Comments (4)

Stewori avatar Stewori commented on June 22, 2024

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.

peanut256 avatar peanut256 commented on June 22, 2024

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.

Stewori avatar Stewori commented on June 22, 2024

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.

rndblnch avatar rndblnch commented on June 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.