Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nodetunes crashes when second client tries to connect #49

Open
sashahilton00 opened this issue Jun 18, 2017 · 1 comment
Open

Nodetunes crashes when second client tries to connect #49

sashahilton00 opened this issue Jun 18, 2017 · 1 comment

Comments

@sashahilton00
Copy link

sashahilton00 commented Jun 18, 2017

Have noticed an issue whereby if a client is streaming to Airtunes, there is an intermittent bug whereby if a second client tries to connect, instead of displaying the 'Someone else is already using the speaker' message, it crashes nodetunes. The steps gone through to initialte the crash are as follows:

  1. Stream to nodetunes with one phone/laptop.
  2. Try streaming from a second client. Normally the first time one tries, you get the message about the speaker being in use, the second time it gives the in use popup twice, and the third time it crashes nodetunes, though I have equally found that this can occur on the first or second time a second client tries to connect at times.

The issue appears to be that on the time it crashes, the line in https://github.com/stephen/nodetunes/blob/master/lib/rtspmethods.js#L28 is trying to parse rtspServer.socket.address().address, which is undefined for whatever reason. This leads to ipaddr.js throwing an exception, and the entire app crashing. A trace is included below.

/Users/sashahilton/Documents/ds/node_modules/ipaddr.js/lib/ipaddr.js:494
      throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format");
      ^

Error: ipaddr: the address has neither IPv6 nor IPv4 format
    at Object.ipaddr.parse (/Users/sashahilton/Documents/ds/node_modules/ipaddr.js/lib/ipaddr.js:494:13)
    at options (/Users/sashahilton/Documents/ds/node_modules/nodetunes/lib/rtspmethods.js:28:31)
    at RtspServer.<anonymous> (/Users/sashahilton/Documents/ds/node_modules/nodetunes/lib/rtsp.js:60:7)
    at emitTwo (events.js:106:13)
    at ServerParser.emit (events.js:192:7)
    at ServerParser._emitMessage (/Users/sashahilton/Documents/ds/node_modules/httplike/lib/server-parser.js:28:8)
    at ServerParser.Parser._write (/Users/sashahilton/Documents/ds/node_modules/httplike/lib/parser.js:91:14)
    at doWrite (_stream_writable.js:329:12)
    at writeOrBuffer (_stream_writable.js:315:5)
    at ServerParser.Writable.write (_stream_writable.js:241:11)
    at Socket.ondata (_stream_readable.js:555:20)

EDIT: This appears to be a rare bug in Node's underlying TCP server. Seen here: nodejs/node-v0.x-archive#7566. Not sure what the work around is...

@sashahilton00
Copy link
Author

Ok, I've modified rtspmethods.js to catch the undefined address bug and return the loopback interface instead. Seems to work fine. Will submit a PR for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant