Summary: | IcedTea Web removes Components from the Applet Container before Applet.stop() causing a Crash. | ||
---|---|---|---|
Product: | [JogAmp] Newt | Reporter: | Sven Gothel <sgothel> |
Component: | awt | Assignee: | Sven Gothel <sgothel> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | xerxes |
Priority: | --- | ||
Version: | 1 | ||
Hardware: | All | ||
OS: | all | ||
Type: | --- | SCM Refs: |
jogl cleanup 87fa56ba6f88b3f87199c70324b919dc4ae4e6cf
jogl cleanup 42f56dea3dc31de8049186825e18dc4b4767827e
jogl cleanup 832a69834200f34a44d72639bfd47e73c72d2b42
jogl cleanup fa1d211c9658ce209f411e559333da0e2fccd402
jogl fix 0c3709ba4ba2dd4ba7bb2e7f0783fba346e090e1
jogl fix 1617b3edfa006432dbb7332c283e219e6583f4ec
jogl 9310b11b2b6e1e89fa5ed9b8de26e56ff6a6b262
jogl 65247a8188c7470ee7f599f2e84cae1bc84fff9c
|
Workaround: | TRUE | ||
Attachments: |
SIGSEGV JVM dump
Debug log Oracle and IcedTea Log: grep -e "^NewtCanvasAWT." -e "^JOGLNewtApplet1Run." Oracle Debug Log (post fix) IcedTea Debug Log (post fix) Oracle and IcedTea Log: grep -e "^NewtCanvasAWT." -e "^JOGLNewtApplet1Run." Oracle Debug Log (post fix) IcedTea Debug Log (post fix) IcedTea-Web 1.5pre+rbc73a1362e9c crash.log.gz DemoBug910ExtendedAWTAppletLifecycleCheck: Oracle Applet DemoBug910ExtendedAWTAppletLifecycleCheck: IcedTea Web 1.3 |
Description
Sven Gothel
2013-11-22 18:47:14 CET
Created attachment 548 [details]
SIGSEGV JVM dump
Created attachment 549 [details]
Debug log
(In reply to comment #0) > 3 - NewtCanvasAWT.removeNotify.0 @ [AWT-EventQueue-0, isAWT-EDT false] If forcing execution of NEwtCanvasAWT.destroyImpl() on 'real' AWT-EDT, i.e. AWT-EventQueue-0, that task never gets executed! (In reply to comment #0) > Issues: > > - Missing: Applet stop() and destroy() ! Not called due to crash ! Created attachment 550 [details]
Oracle and IcedTea Log: grep -e "^NewtCanvasAWT." -e "^JOGLNewtApplet1Run."
Created attachment 551 [details]
Oracle Debug Log (post fix)
Created attachment 552 [details]
IcedTea Debug Log (post fix)
Turns out the difference is the 'NewtCanvasAWT.removeNotify()' call,
which happens before Applet.stop() w/ IcedTea-Web - see attachment 550 [details].
Fix is to detect whether NewtCanvasAWT.removeNotify() is performed on a valid thread. This employs a certain heuristic, since the crash seems to be specific to IcedTea-Web Applet and is not reproduced in other environments. The crash is also not fully understood - since it should be acceptable to destroy the JAWTWindow on a different thread - and locking is properly performed. Heuristic: final boolean destroyJAWTOK = !isApplet || !addedOnAWTEDT || isOnAWTEDT; if !destroyJAWTOK - the JAWTWindow shall be destroyed w/ next call - if destroyJAWTOK. +++ Hence special safeguards needs to be 'installed', i.e. the window-closing-listener is not operated thread safe if removeNotify() is called from !AWT-EDT. Created attachment 553 [details]
Oracle and IcedTea Log: grep -e "^NewtCanvasAWT." -e "^JOGLNewtApplet1Run."
update
Created attachment 554 [details]
Oracle Debug Log (post fix)
update
Created attachment 555 [details]
IcedTea Debug Log (post fix)
update
Preparation / Cleanup of NEWT Applet Code to add workaround for Bug 910: jogl cleanup 87fa56ba6f88b3f87199c70324b919dc4ae4e6cf jogl cleanup 42f56dea3dc31de8049186825e18dc4b4767827e jogl cleanup 832a69834200f34a44d72639bfd47e73c72d2b42 jogl cleanup fa1d211c9658ce209f411e559333da0e2fccd402 Fix as described in comment 9 jogl fix 0c3709ba4ba2dd4ba7bb2e7f0783fba346e090e1 Refined the culprit as documented in comment 9: Applet Launcher removes Components from the Applet Container before Applet.stop() from non AWT-EDT causing a Crash. - NewtCanvasAWT is added to the Applet AWT Container. - Before Applet.stop() is invoked, 'NewtCanvasAWT.removeNotify() is issued, indicating NewtCanvasAWT is removed from the Container. - NewtCanvasAWT should not be removed from the Container before Applet.destroy() has been called. Created attachment 556 [details] IcedTea-Web 1.5pre+rbc73a1362e9c crash.log.gz IcedTea-Web Plugin (using IcedTea-Web 1.5pre+rbc73a1362e9c) (15:20:28) xranby: 1. go to http://jogamp.org/deployment/archive/master/gluegen_751-joal_502-jogl_1160-jocl_881-signed/jogl-test-applets.html (15:20:50) xranby: 2. click on "Dual" top right that links to http://jogamp.org/deployment/archive/master/gluegen_751-joal_502-jogl_1160-jocl_881-signed/jogl-applet-runner-newt-GraphTextDemo01.html (15:21:03) xranby: 3. let the applet load (15:21:18) xranby: 4. press browser back button -> crash xranby@xranby-ESPRIMO-P7935:~$ _JAVA_OPTIONS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" firefox log attached. Reopened: Issue still exist in IcedTea-Web 1.5* IcedTea-Web_1.5pre+rbc73a1362e9c still issues NewtCanvasAWT.removeNotify() before before Applet.destroy(), i.e. removes NewtCanvasAWT from the Container ahead of time (Applet protocol destroy()). However, it fixes the non AWT-EDT issue, i.e. calls NewtCanvasAWT.removeNotify() from the actual AWT-EDT - good. Since the root cause still exist, we cannot use heuristics as described in comment 9, but need to set a flag in NewtCanvasAWT to skip JAWT destruction and remove it latter within Applet.destroy(). NewtCanvasAWT.removeNotify.0 - isApplet true @ [AWT-EventQueue-0, isAWT-EDT true] Commit 1617b3edfa006432dbb7332c283e219e6583f4ec adds workaround as described in comment 17. IcedTea-Web_1.5pre+rbc73a1362e9c using src: http://icedtea.classpath.org/hg/icedtea-web/rev/bc73a1362e9c is now able to run and close all the applets; Dual, LApplet and NApplet w/o crashing. tested using: http://jogamp.org/deployment/archive/master/gluegen_751-joal_502-jogl_1161-jocl_882-signed/jogl-test-applets.html The workaround work. 9310b11b2b6e1e89fa5ed9b8de26e56ff6a6b262 Bug 910: Add Standalone Extended Applet Lifecycle Validation Test Test is online @ http://jogamp.org/deployment/test/bug910/ Test validates the state of the added component: TC1 - addNotify() and removeNotify() has been called from AWT-EDT. TC2 - removeNotify() is not called before Applet.destroy() Test also validates the Applet state: TA1 - isActive() TA2 - init count TA3 - start count TA4 - stop count TA5 - destroy count Created attachment 559 [details]
DemoBug910ExtendedAWTAppletLifecycleCheck: Oracle Applet
Created attachment 560 [details]
DemoBug910ExtendedAWTAppletLifecycleCheck: IcedTea Web 1.3
IcedTea Web exposes the following errors: isActive() state between start()-stop(): ======================== Applet-State @ start: ERROR, active[exp true, has false]*, init[exp 1, has 1], start[exp 1, has 1], stop[exp 0, has 0], destroy[exp 0, has 0] removeNotify() not called from AWT-EDT (Fixed in 1.5*): ================================ Applet.Canvas.removeNotify() ERROR: Not on AWT-EDT removeNotify() called before destroy(): ======================== Component-State @ stop: ERROR, contained[exp true, has true], addNotify[exp 1, has 1], removeNotify[exp 0, has 1]*, compCount 1, compClazz canvas0 Component-State @ destroy-remove.pre: ERROR, contained[exp true, has true], addNotify[exp 1, has 1], removeNotify[exp 0, has 1]*, compCount 1, compClazz canvas0 (In reply to comment #23) > IcedTea Web exposes the following errors: > > isActive() state between start()-stop(): > ======================== > Applet-State @ start: ERROR, active[exp true, has false]*, init[exp 1, has > 1], start[exp 1, has 1], stop[exp 0, has 0], destroy[exp 0, has 0] > > removeNotify() not called from AWT-EDT (Fixed in 1.5*): > ================================ > Applet.Canvas.removeNotify() ERROR: Not on AWT-EDT > > removeNotify() called before destroy(): > ======================== > Component-State @ stop: ERROR, contained[exp true, has true], addNotify[exp > 1, has 1], removeNotify[exp 0, has 1]*, compCount 1, compClazz canvas0 > Component-State @ destroy-remove.pre: ERROR, contained[exp true, has true], > addNotify[exp 1, has 1], removeNotify[exp 0, has 1]*, compCount 1, compClazz > canvas0 See attachment 560 [details] or test is online @ http://jogamp.org/deployment/test/bug910/ 65247a8188c7470ee7f599f2e84cae1bc84fff9c Refine DemoBug910ExtendedAWTAppletLifecycleCheck: Test start/stop balance. Updated on http://jogamp.org/deployment/test/bug910/ Assigned bug to IcedTea Web: http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1607 |