bisq-network / bisq

A decentralized bitcoin exchange network
https://bisq.network
GNU Affero General Public License v3.0
4.64k stars 1.26k forks source link

Investigate InvalidProtocolBufferException #1115

Closed ManfredKarrer closed 1 month ago

ManfredKarrer commented 6 years ago

We get from time to time InvalidProtocolBufferExceptions like the one below. It might be non critical and caused due network diconnections but would be good to investigate what causes them and find out more about that.

com.google.protobuf.InvalidProtocolBufferException: While parsing a protocol message, the input ended unexpectedly in the middle of a field. This could mean either that the input has been truncated or that an embedded message misreported its own length. at com.google.protobuf.InvalidProtocolBufferException.truncatedMessage(InvalidProtocolBufferException.java:82) at com.google.protobuf.CodedInputStream$StreamDecoder.readRawBytesSlowPath(CodedInputStream.java:2803) at com.google.protobuf.CodedInputStream$StreamDecoder.readBytes(CodedInputStream.java:2336) at io.bisq.generated.protobuffer.PB$ProtectedStorageEntry.(PB.java:43287)

ManfredKarrer commented 6 years ago

@tau3 Do you have idea what causes that? It might have been a result of a connection loss during PB parsing and maybe it was related to your recent fix in the Connection class?

tau3 commented 6 years ago

@ManfredKarrer i'm not sure actually. Should we add trace logging calls where proto is written to output streams? At least we will be able to see actual message and reported size.

ManfredKarrer commented 6 years ago

@tau3 It might be that it just happens when network connection breaks. I saw it in dev mode when I kill the app without proper shutdown. I will be hard to trace with logs as it does not happen often and then there will be a lot of log data. But you can try... but anyway was not super critical, just was wondering if you might have stumbled over such an exception in other projects...

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

ManfredKarrer commented 4 years ago

Still relevant

ghubstan commented 4 years ago

I've seen this problem before while working with Hadoop, HBase, and a proprietary, distributed OLAP engine. Network failures often coincided with the exception.

I wondered if instrumenting protobuf's generated classes in a way that could provide more info about the causes of these exceptions was possible, but it seems not, and probably not a good idea anyway.

I see non-proto generated Bisq code catches InvalidProtocolBufferExceptions in one place: bisq.network.crypto.EncryptionService.java. Do you think detecting and reporting Socket problems in that and other catch blocks that might be handling bubbled up Throwables would be possible and useful in determining if these exceptions always or usually occur after network failures?

ghost commented 4 years ago

If helpful, see my weekly report(s) about pricenodes monitoring. edit: oups, forgot the link -> https://github.com/bisq-network/roles/issues/10#issuecomment-518116749 It has also link to detailed data.