Qoracoin / Qora

Public GIT for the Qora cryptocurrency project.
http://qora.org
Other
43 stars 24 forks source link

ClosedByInterruptException in Pinger #91

Closed catbref closed 6 years ago

catbref commented 6 years ago
2018-03-06 15:00:19 INFO  Network:92 - Connection close : /213.226.223.66
Exception in thread "Pinger /213.226.223.66" java.io.IOError: java.nio.channels.
ClosedByInterruptException
        at org.mapdb.Volume$FileChannelVol.getLong(Volume.java:977)
        at org.mapdb.StoreWAL.getLinkedRecordsFromLog(StoreWAL.java:880)
        at org.mapdb.StoreWAL.update(StoreWAL.java:380)
        at org.mapdb.Caches$HashTable.update(Caches.java:270)
        at org.mapdb.BTreeMap.put2(BTreeMap.java:707)
        at org.mapdb.BTreeMap.put(BTreeMap.java:643)
        at database.PeerMap.addPeer(PeerMap.java:446)
        at network.Peer.onPingSuccess(Peer.java:146)
        at network.Pinger.run(Pinger.java:80)
Caused by: java.nio.channels.ClosedByInterruptException
        at java.nio.channels.spi.AbstractInterruptibleChannel.end(Unknown Source
)
        at sun.nio.ch.FileChannelImpl.readInternal(Unknown Source)
        at sun.nio.ch.FileChannelImpl.read(Unknown Source)
        at org.mapdb.Volume$FileChannelVol.readFully(Volume.java:946)
        at org.mapdb.Volume$FileChannelVol.getLong(Volume.java:974)
        ... 8 more
Exception in thread "BlockGenerator" java.io.IOError: java.nio.channels.ClosedCh
annelException
        at org.mapdb.Volume$FileChannelVol.putByte(Volume.java:920)
        at org.mapdb.StoreWAL.walIndexVal(StoreWAL.java:277)
        at org.mapdb.StoreWAL.update(StoreWAL.java:413)
        at org.mapdb.Caches$HashTable.update(Caches.java:270)
        at org.mapdb.Atomic$Var.set(Atomic.java:688)
        at database.BlockMap.setLastBlock(BlockMap.java:143)
        at qora.block.Block.process(Block.java:781)
        at qora.block.Block.process(Block.java:711)
        at qora.Synchronizer.process(Synchronizer.java:320)
        at qora.Synchronizer.synchronize(Synchronizer.java:458)
        at controller.Controller.update(Controller.java:1046)
        at qora.BlockGenerator.run(BlockGenerator.java:185)
Caused by: java.nio.channels.ClosedChannelException
        at sun.nio.ch.FileChannelImpl.ensureOpen(Unknown Source)
        at sun.nio.ch.FileChannelImpl.write(Unknown Source)
        at org.mapdb.Volume$FileChannelVol.writeFully(Volume.java:865)
        at org.mapdb.Volume$FileChannelVol.putByte(Volume.java:918)
        ... 11 more

This looks like pinger.interrupt() is being called and Pinger's run() thread calls Peer.onPingSuccess() before exiting thread. Peer.onPingSuccess() does a mapdb call and if interrupt status isn't cleared before a mapdb call then the FileChannel is closed and everything goes wrong!

catbref commented 6 years ago

Should be fixed in newly released v0.26.7 - please confirm!

catbref commented 6 years ago

Closing due to no new reports and substantial code change in Peer class