From: SourceForge.net <no...@so...> - 2009-11-24 17:47:39
|
Bugs item #2901257, was opened at 2009-11-20 16:54 Message generated for change (Comment added) made by dirkwalter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=379133&aid=2901257&group_id=23629 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: v11 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Dirk Walter (dirkwalter) Assigned to: Nobody/Anonymous (nobody) Summary: Random NullPointerException Initial Comment: I occasionally randomly get a nullpointer exception, I think it is a threading issue since it ussualy happens if I change the molecule I am showing before it finishes displaying another one. I am using jmol 11.8.9. Stacktrace: java.lang.NullPointerException at org.jmol.viewer.Viewer.getModelFileNumber(Unknown Source) at org.jmol.viewer.Viewer.setStatusFrameChanged(Unknown Source) at org.jmol.viewer.AnimationManager.setStatusFrameChanged(Unknown Source) at org.jmol.viewer.AnimationManager.setAnimationOff(Unknown Source) at org.jmol.viewer.AnimationManager.setAnimationOn(Unknown Source) at org.jmol.viewer.AnimationManager.clearAnimation(Unknown Source) at org.jmol.viewer.AnimationManager.clear(Unknown Source) at org.jmol.viewer.Viewer.zap(Unknown Source) at org.jmol.viewer.Viewer.zap(Unknown Source) at org.jmol.viewer.Viewer.createModelSetAndReturnError(Unknown Source) at org.jmol.viewer.Viewer.createModelSetInline(Unknown Source) at org.jmol.viewer.Viewer.openStringInline(Unknown Source) ---------------------------------------------------------------------- >Comment By: Dirk Walter (dirkwalter) Date: 2009-11-24 17:47 Message: Two more random nullpointer exceptions, not sure if they are related, still using 11.8.9, but now all data is loaded using the data command, so threading should not be an issue. They also happened right after each other so they are probably related. java.lang.NullPointerException at org.jmol.viewer.Viewer.getVisibleFramesBitSet(Unknown Source) at org.jmol.modelset.ModelSet.setModelVisibility(Unknown Source) at org.jmol.viewer.Viewer.setModelVisibility(Unknown Source) at org.jmol.viewer.Viewer.renderScreenImage(Unknown Source) at org.jmol.viewer.Viewer.renderScreenImage(Unknown Source) at gov.nih.nhlbi.icbl.qbt.biochemistry.gui.editors.panels.JmolPanel.paint(JmolPanel.java:83) at javax.swing.JComponent.paintToOffscreen(JComponent.java:5124 java.lang.NullPointerException at org.jmol.viewer.Viewer.setShapeProperty(Unknown Source) at org.jmol.viewer.Viewer.hoverOff(Unknown Source) at org.jmol.viewer.MouseManager.hoverOff(Unknown Source) at org.jmol.viewer.MouseManager.mouseEntered(Unknown Source) at org.jmol.viewer.MouseManager11.mouseEntered(Unknown Source) at java.awt.Component.processMouseEvent(Component.java:6272) at javax.swing.JComponent.processMouseEvent(JComponent.java:3 *-*-*-*-* The relevant code in the custom JPanel: public void paint(Graphics g) { if(hide || queue.hasQueued()) { super.paint(g); //paint a blank panel while waiting for data } else { getSize(currentSize); g.getClipBounds(rectClip); viewer.renderScreenImage(g, currentSize, rectClip); } } ---------------------------------------------------------------------- Comment By: Dirk Walter (dirkwalter) Date: 2009-11-23 21:09 Message: That could very well by happening, I fire a event that goes into the Event Dispatch thread to update the JMol panel, then returns, at which point the next thread might be going into the EDT to fire another update, such as when the user is scrolling through the list. ---------------------------------------------------------------------- Comment By: Bob Hanson (hansonr) Date: 2009-11-23 18:22 Message: That's supposed to work fine. The applet, for example, does exactly that to apply a script after a load of string data. The curious thing here is that the zap method is finding a null modelSet. That implies there is a command being given by another thread prior to the zap command that is clearing out the model set. But as far as I can see, the only command that would do that would be zap itself. How two threads got going like that is still a mystery to me. I've made some changes that should make it completely impossible to ever hit this exception again, but of course it would be more satisfying to know why it happened in the first place. About the only thing I can imagine is that you issue a load or zap command within jmolviewer.script("....") and then, shortly thereafter you also issue jmolviewer.openStringInline(...) The first would be running queued by the script processor thread, and the second would be excuted by the Event thread. Curious.... ---------------------------------------------------------------------- Comment By: Dirk Walter (dirkwalter) Date: 2009-11-23 17:37 Message: I am following it with another command, so that would be the source of the problem. We have 2 types of molecules we are showing and we have different display scripts for each, so I do a openStringInline followed by a evalString to set the display properties, I made sure the commands are done in the Event dispatch thread and called in that order. I will try the data command and see if it solves the problem, unless there is a better way? ---------------------------------------------------------------------- Comment By: Bob Hanson (hansonr) Date: 2009-11-23 13:20 Message: Dirk, openStringInline should work fine provided that is all you are doing and not following it up with some other command. The alternative is a DATA command within a script. I'm still puzzling over why the ZAP command from that is finding no model set. The only think I can think of is that you are issuing two commands in a row, first a jmolViewer.script() or jmolViewer.evalString() command, which gets queued and executed by an independent thread, and then this openStringInline command. Bob ---------------------------------------------------------------------- Comment By: Dirk Walter (dirkwalter) Date: 2009-11-23 12:06 Message: if openStringInline is not the way to do it how would I do this better? ---------------------------------------------------------------------- Comment By: Bob Hanson (hansonr) Date: 2009-11-22 19:27 Message: I believe this is a bug that goes WAY back to the origins of Jmol. I have checked in fixes for Jmol 11.9.11 and Jmol 11.8.10. The problem arises from the repaint renderer thread continuing during the zap command. Possibly... ---------------------------------------------------------------------- Comment By: Bob Hanson (hansonr) Date: 2009-11-20 18:59 Message: hmm, the zap is only being called from createModelSetAndReturnError because there was an error in the data so that an atom set was not created. It's trying to clear the (already cleared) model with a zap. That could be the problem. ---------------------------------------------------------------------- Comment By: Bob Hanson (hansonr) Date: 2009-11-20 18:54 Message: I see you are using openStringInline. That's not queued, and it could be causing the problem. I'll look into that. It would be nice to get this to be reproducible. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=379133&aid=2901257&group_id=23629 |