Data collection fails with error "java.lang.ArithmeticException: / by zero" in RSA Identity Governance & Lifecycle
2 years ago
Originally Published: 2019-02-21
Article Number
000044705
Applies To
RSA Product Set:  Identity Governance & Lifecycle
RSA Version/Condition: 6.9.1, 7.0.0, 7.0.1, 7.0.2
Issue

A CSV data collector that has been successfully running abruptly fails due to the Admin error shown below: 

EC[31002] Context[Collector Name=ADC, Agent Name=AveksaAgent, Data Run ID=448Reason=java.lang.ArithmeticException: / by zero] Message[Data collection failed on the agent]


From the aveksaServer.log, you will see the following error:

03/20/2017 00:38:09.081 INFO (Thread-26) [com.aveksa.client.component.communication.ChangeListHandler] Got new change item method=Run ChangeItem[ID=236, type=CollectionRequest, source=76, source-name=ADC]
03/20/2017 00:38:09.083 INFO (ApplyChangesRegularThread-138) [com.aveksa.client.component.communication.ChangeListHandler] STARTING method=ApplyChanges subTask=Acting on a changeItem ChangeItem[ID=236, type=CollectionRequest, source=76, source-name=ADC]
03/20/2017 00:38:09.084 INFO (ApplyChangesRegularThread-138) [com.aveksa.client.component.DefaultComponentManager] DCM132: Ignoring Event: com.aveksa.client.component.event.CollectionRequestEvent[source=com.aveksa.client.component.communication.DefaultCommunicationManager@50f85f07]
03/20/2017 00:38:09.084 INFO (ApplyChangesRegularThread-138) [com.aveksa.client.datacollector.framework.DataCollectorManager] STARTING method=Collect CollectionMetaInfo[{ID=15, run_id=338, collector_id=76, test-run=false, collector_name=ADC}]
03/20/2017 00:38:09.103 ERROR (ApplyChangesRegularThread-138) [com.aveksa.client.datacollector.framework.DataCollectorManager] FAILED method=Collect CollectionMetaInfo[{ID=15, run_id=338, collector_id=76, test-run=false, collector_name=ADC, data_size=8193, data_file=/home/oracle/jboss-4.2.2.GA/server/default/./deploy/aveksa.ear/aveksa.war/WEB-INF/LocalAgent/collected_data/15.data}] java.lang.ArithmeticException: / by zero      
   at com.aveksa.common.hash.HashManager.getNewHash(HashManager.java:83)
   at com.aveksa.client.component.cache.FileSystemCache.generateHash(FileSystemCache.java:354)
   at com.aveksa.client.component.cache.FileSystemCache.closeDataWriter(FileSystemCache.java:348)
   at com.aveksa.client.component.cache.FileSystemCache.access$100(FileSystemCache.java:55)
   at com.aveksa.client.component.cache.FileSystemCache$DataWriter.close(FileSystemCache.java:298)
   at com.aveksa.common.utils.StreamUtils.close(StreamUtils.java:52)
   at com.aveksa.client.datacollector.collectors.accountdatacollectors.AccountDataCollector.collect(AccountDataCollector.java:303)
   at com.aveksa.client.datacollector.collectors.accountdatacollectors.AccountDataCollector.collect(AccountDataCollector.java:269)
   at com.aveksa.client.datacollector.framework.DataCollectorManager.collect(DataCollectorManager.java:536)
   at com.aveksa.client.component.collector.DefaultCollectorManager.actUpon(DefaultCollectorManager.java:203)
   at com.aveksa.client.component.collector.DefaultCollectorManager.handle(DefaultCollectorManager.java:102)
   at com.aveksa.client.component.event.DefaultEventManager.handle(DefaultEventManager.java:60)
   at com.aveksa.client.datacollector.framework.SimpleEventSource.notifyListeners(SimpleEventSource.java:67)
   at com.aveksa.client.component.communication.DefaultCommunicationManager.notifyEvent(DefaultCommunicationManager.java:377)
   at com.aveksa.client.component.communication.ChangeListHandler.applyChanges(ChangeListHandler.java:364)
   at com.aveksa.client.component.communication.ChangeListHandler.access$300(ChangeListHandler.java:58)
   at com.aveksa.client.component.communication.ChangeListHandler$ChangeApplyingRunnable.run(ChangeListHandler.java:275)
   at java.lang.Thread.run(Thread.java:701)

Cause
This is due to bad logic in the code that calculates Hash values for transient files that collectors use for processing.

It only manifests itself when the size of the internal file is between 8192 and 8195 bytes. Because the internal file is in XML format, it is impossible to predict its size from a CSV file, because it also depends on the query that the collector executes.
Resolution
This issue has been fixed on RSA Identity Governance & Lifecycle 7.0.2 P04+, 7.1.x.
Workaround
As a workaround, the only solution is to add some dummy data into the affected collector.

For example, if an ADC reads accounts, add two identical dummy account records into the feed. This will increase the internal file, but the collector would reject duplicate dummy accounts and not propagate them into the system.