Opened 3 years ago

Closed 3 years ago

#1821 closed defect (fixed)

NPE in streaming ConnectionHandler

Reported by: str4d Owned by:
Priority: minor Milestone: 0.9.27
Component: streaming Version: 0.9.26
Keywords: Cc:
Parent Tickets: Sensitive: no

Description

ConnectionHandler.sendReset(packet) throws the following NPE when debug logging is enabled:

WARN [te #10167]: ] reaming.impl.ConnectionHandler: Dropping new SYN request, as we're not listening
ERROR [te #10167]: ] lient.impl.I2PSessionMuxedImpl: Error notifying app of message availability
     java.lang.NullPointerException
     at net.i2p.client.streaming.impl.Packet.toFlagString(Packet.java:783)
     at net.i2p.client.streaming.impl.Packet.formatAsString(Packet.java:755)
     at net.i2p.client.streaming.impl.PacketLocal.formatAsString(PacketLocal.java:252)
     at net.i2p.client.streaming.impl.Packet.toString(Packet.java:739)
     at java.lang.String.valueOf(String.java:2849)
     at java.lang.StringBuilder.append(StringBuilder.java:128)
     at net.i2p.client.streaming.impl.ConnectionHandler.sendReset(ConnectionHandler.java:258)
     at net.i2p.client.streaming.impl.ConnectionHandler.receiveNewSyn(ConnectionHandler.java:85)
     at net.i2p.client.streaming.impl.PacketHandler.receiveUnknownCon(PacketHandler.java:310)
     at net.i2p.client.streaming.impl.PacketHandler.receivePacketDirect(PacketHandler.java:109)
     at net.i2p.client.streaming.impl.PacketHandler.receivePacket(PacketHandler.java:92)
     at net.i2p.client.streaming.impl.MessageHandler.messageAvailable(MessageHandler.java:78)
     at net.i2p.client.impl.I2PSessionDemultiplexer.messageAvailable(I2PSessionDemultiplexer.java:43)
     at net.i2p.client.impl.I2PSessionMuxedImpl$MuxedAvailabilityNotifier.run(I2PSessionMuxedImpl.java:400)
     at java.lang.Thread.run(Thread.java:745)
     at net.i2p.util.I2PThread.run(I2PThread.java:103)

Steps to recreate:

  1. Set net.i2p.client.streaming.impl.ConnectionHandler=DEBUG in logging config.
  2. Wait for ConnectionHandler.sendReset() to be called.

I believe it is caused by sendReset() calling reply.setFlag(Packet.FLAG_SIGNATURE_INCLUDED) instead of reply.setOptionalSignature(sig).

Subtickets

Change History (1)

comment:1 Changed 3 years ago by zzz

Milestone: undecided0.9.27
Resolution: fixed
Status: newclosed

Fixed in c62904685f0153a5b8cd032e8b3f1c4f64c5bec9 0.9.26-8 untested

The sig will be set later on, the flag tells it to be signed. The fix just handles that case in the toFlagString() code.

Note: See TracTickets for help on using tickets.