Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Random "Error: invalid ip address" crash #93

Closed
mkg20001 opened this issue Jun 16, 2018 · 0 comments · Fixed by #96
Closed

Random "Error: invalid ip address" crash #93

mkg20001 opened this issue Jun 16, 2018 · 0 comments · Fixed by #96

Comments

@mkg20001
Copy link
Member

The libp2p-nodetrust server crashed because of an incoming TCP connection.
Unsure what caused this.

Logs:

2018-06-14T19:01:26.104Z libp2p:tcp:listen new connection /ip4/185.156.177.133/tcp/26907
2018-06-14T19:01:26.148Z libp2p:tcp:listen new connection /ip4/185.156.177.133/tcp/27966
Error: invalid ip address
    at ip2buf (/home/maciej/libp2p-nodetrust/server/node_modules/libp2p-tcp/node_modules/multiaddr/src/convert.js:72:32)
    at Function.convertToBuffer [as toBuffer] (/home/maciej/libp2p-nodetrust/server/node_modules/libp2p-tcp/node_modules/multiaddr/src/convert.js:49:14)
    at /home/maciej/libp2p-nodetrust/server/node_modules/libp2p-tcp/node_modules/multiaddr/src/codec.js:85:35
    at arrayMap (/home/maciej/libp2p-nodetrust/server/node_modules/lodash.map/index.js:140:21)
    at map (/home/maciej/libp2p-nodetrust/server/node_modules/lodash.map/index.js:1836:10)
    at stringTuplesToTuples (/home/maciej/libp2p-nodetrust/server/node_modules/libp2p-tcp/node_modules/multiaddr/src/codec.js:79:10)
    at stringToBuffer (/home/maciej/libp2p-nodetrust/server/node_modules/libp2p-tcp/node_modules/multiaddr/src/codec.js:171:13)
    at Object.fromString (/home/maciej/libp2p-nodetrust/server/node_modules/libp2p-tcp/node_modules/multiaddr/src/codec.js:178:10)
    at ClassIsWrapper.withIs.proto.className (/home/maciej/libp2p-nodetrust/server/node_modules/libp2p-tcp/node_modules/multiaddr/src/index.js:40:25)
    at new Multiaddr (/home/maciej/libp2p-nodetrust/server/node_modules/class-is/index.js:40:33)
    at withIs.proto.className (/home/maciej/libp2p-nodetrust/server/node_modules/libp2p-tcp/node_modules/multiaddr/src/index.js:26:12)
    at Multiaddr (/home/maciej/libp2p-nodetrust/server/node_modules/class-is/index.js:40:33)
    at module.exports (/home/maciej/libp2p-nodetrust/server/node_modules/libp2p-tcp/src/get-multiaddr.js:23:10)
    at Server.net.createServer (/home/maciej/libp2p-nodetrust/server/node_modules/libp2p-tcp/src/listener.js:27:18)
    at emitOne (events.js:116:13)
    at Server.emit (events.js:211:7)
    at TCP.onconnection (net.js:1565:8)

More details: https://sentry.zion.host/share/issue/b1f38bc0602b46bd948b18bdb8c91523/

TomCoded added a commit to TomCoded/js-libp2p-tcp that referenced this issue Jul 23, 2018
Per the nodeJS documentation, a Net socket.remoteAddress value may
be undefined if the socket is destroyed, as by a client disconnect.
A multiaddr cannot be created for an invalid IP address (such as
the undefined remote address of a destroyed socket). Currently
the attempt results in a crash that can be triggered remotely. This
commit terminates processing of a destroyed socket before multiaddr
causes the crash.

fixes: libp2p#93
fixes: ipfs/js-ipfs#1447
TomCoded added a commit to TomCoded/js-libp2p-tcp that referenced this issue Jul 23, 2018
Per the nodeJS documentation, a Net socket.remoteAddress value may
be undefined if the socket is destroyed, as by a client disconnect.
A multiaddr cannot be created for an invalid IP address (such as
the undefined remote address of a destroyed socket). Currently
the attempt results in a crash that can be triggered remotely. This
commit terminates processing of a destroyed socket before multiaddr
causes the crash.

fixes: libp2p#93
fixes: ipfs/js-ipfs#1447
TomCoded added a commit to TomCoded/js-libp2p-tcp that referenced this issue Jul 23, 2018
Per the nodeJS documentation, a Net socket.remoteAddress value may
be undefined if the socket is destroyed, as by a client disconnect.
A multiaddr cannot be created for an invalid IP address (such as
the undefined remote address of a destroyed socket). Currently
the attempt results in a crash that can be triggered remotely. This
commit terminates processing of a destroyed socket before multiaddr
causes the crash.

fixes: libp2p#93
fixes: ipfs/js-ipfs#1447
TomCoded added a commit to TomCoded/js-libp2p-tcp that referenced this issue Jul 31, 2018
Per the nodeJS documentation, a Net socket.remoteAddress value may
be undefined if the socket is destroyed, as by a client disconnect.
A multiaddr cannot be created for an invalid IP address (such as
the undefined remote address of a destroyed socket). Currently
the attempt results in a crash that can be triggered remotely. This
commit catches the exception in get-multiaddr and returns an
undefined value to listener rather than throwing an exception when
trying to process defective or destroyed socket data. Listener then
terminates processing of the incoming p2p connections that generate
this error condition.

fixes: libp2p#93
fixes: ipfs/js-ipfs#1447
TomCoded added a commit to TomCoded/js-libp2p-tcp that referenced this issue Jul 31, 2018
Per the nodeJS documentation, a Net socket.remoteAddress value may
be undefined if the socket is destroyed, as by a client disconnect.
A multiaddr cannot be created for an invalid IP address (such as
the undefined remote address of a destroyed socket). Currently
the attempt results in a crash that can be triggered remotely. This
commit catches the exception in get-multiaddr and returns an
undefined value to listener rather than throwing an exception when
trying to process defective or destroyed socket data. Listener then
terminates processing of the incoming p2p connections that generate
this error condition.

fixes: libp2p#93
fixes: ipfs/js-ipfs#1447
TomCoded added a commit to TomCoded/js-libp2p-tcp that referenced this issue Jul 31, 2018
Per the nodeJS documentation, a Net socket.remoteAddress value may
be undefined if the socket is destroyed, as by a client disconnect.
A multiaddr cannot be created for an invalid IP address (such as
the undefined remote address of a destroyed socket). Currently
the attempt results in a crash that can be triggered remotely. This
commit catches the exception in get-multiaddr and returns an
undefined value to listener rather than throwing an exception when
trying to process defective or destroyed socket data. Listener then
terminates processing of the incoming p2p connections that generate
this error condition.

fixes: libp2p#93
fixes: ipfs/js-ipfs#1447
jacobheun pushed a commit that referenced this issue Jul 31, 2018
Per the nodeJS documentation, a Net socket.remoteAddress value may
be undefined if the socket is destroyed, as by a client disconnect.
A multiaddr cannot be created for an invalid IP address (such as
the undefined remote address of a destroyed socket). Currently
the attempt results in a crash that can be triggered remotely. This
commit catches the exception in get-multiaddr and returns an
undefined value to listener rather than throwing an exception when
trying to process defective or destroyed socket data. Listener then
terminates processing of the incoming p2p connections that generate
this error condition.

fixes: #93
fixes: ipfs/js-ipfs#1447
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant