beast-dev/tracer

Tracer crashes on very small positive values

bredelings opened this issue · 3 comments

I have some log files that tracer does not like. Sometimes it throws an exception, and sometimes it starts allocating increasingly large amounts of memory while doing nothing.

  1. If invoked with tracer c.txt, tracer get stuck before it shows any statistics. It starts allocating all the memory (i.e. > 7G) and must be killed.
    c.txt
    However, if the last line of the file is removed, then tracer works fine. The last line contains the value 5.3913975099062396e-70, and it seems that it is this value that is causing the problem...

  2. If invoked with tracer a.txt tracer load and shows statistics. If you click on certain variables, it will stall and allocate all the memory. However, on other variables, it will show the following exception:

Exception in thread "AWT-EventQueue-0" java.lang.NegativeArraySizeException: -2147483647
	at dr.util.FrequencyDistribution.init(Unknown Source)
	at dr.util.FrequencyDistribution.<init>(Unknown Source)
	at dr.app.gui.chart.HistogramPlot.getFrequencyDistribution(Unknown Source)
	at dr.app.gui.chart.HistogramPlot.setData(Unknown Source)
	at dr.app.gui.chart.HistogramPlot.setData(Unknown Source)
	at dr.app.gui.chart.HistogramPlot.<init>(Unknown Source)
	at tracer.traces.FrequencyPanel.setupTraces(Unknown Source)
	at tracer.traces.TraceChartPanel.setupMainPanel(Unknown Source)
	at tracer.traces.TraceChartPanel.setTraces(Unknown Source)
	at tracer.traces.SummaryStatisticsPanel.setTraces(Unknown Source)
	at tracer.traces.TracePanel.setTraces(Unknown Source)
	at tracer.application.TracerFrame.statisticTableSelectionChanged(Unknown Source)
	at tracer.application.TracerFrame$5.valueChanged(Unknown Source)
	at java.desktop/javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:224)
	at java.desktop/javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:191)
	at java.desktop/javax.swing.DefaultListSelectionModel.setValueIsAdjusting(DefaultListSelectionModel.java:728)
	at java.desktop/javax.swing.plaf.basic.BasicTableUI$Handler.setValueIsAdjusting(BasicTableUI.java:992)
	at java.desktop/javax.swing.plaf.basic.BasicTableUI$Handler.mouseReleased(BasicTableUI.java:1205)
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:298)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6626)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389)
	at java.desktop/java.awt.Component.processEvent(Component.java:6391)
	at java.desktop/java.awt.Container.processEvent(Container.java:2266)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5001)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:746)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:744)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:743)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

a.txt

BTW, this is with openjdk-17 on debian linux.

Remco reported the similar issue. It seems not only positive. As long as the values are very close, tracer will fail. For Mac version, there is no exception and message to inform the status.

An example is attached y.log

The problem was caused by the original code in https://github.com/beast-dev/beast-mcmc/blob/0f199b83a4598bd0bb8a50d66a52e47723ac3850/src/dr/app/gui/chart/Axis.java#L485-L498

Plotting is messed up, if values range is very small (range < 1.0E-30). I am not sure why to use this code, so I create a LinearAxis2 to handle this issue, which overwrites Axis.AbstractAxis#calibrate(). Then, the corresponding axes in histogram chart, density, and trace are all changed to use LinearAxis2.

The attached 3 files all passed testing.