[BUG] crash in TorControlConnection
Describe the Bug Found on Google Play vital statistics
Smartphone (please complete the following information): Nothing Nothing Phone (1) Android 15 (SDK 35) Version: 1770200102 (17.7.0-BETA-1-tor-0.4.8.18)Occurred: 2 days ago
Crash Logs (Advanced)
Type java.util.ConcurrentModificationException
Exception java.util.ConcurrentModificationException: at java.util.ArrayList$Itr.checkForComodification (ArrayList.java:1111) at java.util.ArrayList$Itr.next (ArrayList.java:1064) at net.freehaven.tor.control.TorControlConnection.handleEvent (TorControlConnection.java:239) at net.freehaven.tor.control.TorControlConnection.react (TorControlConnection.java:382) at net.freehaven.tor.control.TorControlConnection$ControlParseThread.run (TorControlConnection.java:352)
This is in jtorcontrol and technically not in Orbot.
for (RawEventListener rawEventListener : rawEventListeners) {
rawEventListener.onEvent(tp, rest);
}
https://stackoverflow.com/questions/8104692/how-to-avoid-java-util-concurrentmodificationexception-when-iterating-through-an
In tor-android's TorService
we remove raw event listeners in onDesotry()
@Override
public void onDestroy() {
super.onDestroy();
if (torControlConnection != null) {
torControlConnection.removeRawEventListener(startedEventListener);
}
if (runLock.isLocked()) {
Log.i(TAG, "Releasing lock");
runLock.unlock();
}
shutdownTor();
broadcastStatus(TorService.this, STATUS_OFF);
}
This java.util.ConcurrentModificationException seems to occur if the event loop posted above is actively executing while somewhere else a call to removeRawEventListener is called such as the one above