Floby / node-libspotify

Node bindings for the libspotify C library
projects.flo.by/node-libspotify/
102 stars 66 forks source link

Segmentation fault when delivering music #41

Open LinusU opened 11 years ago

LinusU commented 11 years ago
[../deps/mpg123/src/output/coreaudio.c:81] warning: Didn't have any audio data in callback (buffer underflow)

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x000008c4719245b9 in ?? ()
(gdb) bt
#0  0x000008c4719245b9 in ?? ()
#1  0x000008c4719118b7 in ?? ()
#2  0x000000010018a28c in v8::internal::Invoke ()
#3  0x0000000100146364 in v8::Function::Call ()
#4  0x00000001021055b4 in read_delivered_music (handle=<value temporarily unavailable, due to optimizations>, status=<value temporarily unavailable, due to optimizations>) at ../src/player.cc:132
#5  0x000000010012f60c in uv__run_timers ()
#6  0x0000000100125f7e in uv_run ()
#7  0x000000010000c6e3 in node::Start ()
#8  0x00000001000039f4 in start ()
(gdb) 
LinusU commented 11 years ago

Got one more, it seems that there is always at least one buffer underflow before this happens. Last time there was one, this time four.

[../deps/mpg123/src/output/coreaudio.c:81] warning: Didn't have any audio data in callback (buffer underflow)
[../deps/mpg123/src/output/coreaudio.c:81] warning: Didn't have any audio data in callback (buffer underflow)
[../deps/mpg123/src/output/coreaudio.c:81] warning: Didn't have any audio data in callback (buffer underflow)
[../deps/mpg123/src/output/coreaudio.c:81] warning: Didn't have any audio data in callback (buffer underflow)

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
0x0000360b14f245b9 in ?? ()
(gdb) bt   
#0  0x0000360b14f245b9 in ?? ()
#1  0x0000360b14f118b7 in ?? ()
#2  0x000000010018a28c in v8::internal::Invoke ()
#3  0x0000000100146364 in v8::Function::Call ()
#4  0x00000001021055b4 in read_delivered_music (handle=<value temporarily unavailable, due to optimizations>, status=<value temporarily unavailable, due to optimizations>) at ../src/player.cc:132
#5  0x000000010012f60c in uv__run_timers ()
#6  0x0000000100125f7e in uv_run ()
#7  0x000000010000c6e3 in node::Start ()
#8  0x00000001000039f4 in start ()
(gdb) 
Floby commented 11 years ago

Are you sure this isn't a node core audio error? Le 22 oct. 2013 02:11, "Linus Unnebäck" notifications@github.com a écrit :

Got one more, it seems that there is always at least one buffer underflow before this happens. Last time there was one, this time four.

[../deps/mpg123/src/output/coreaudio.c:81] warning: Didn't have any audio data in callback (buffer underflow) [../deps/mpg123/src/output/coreaudio.c:81] warning: Didn't have any audio data in callback (buffer underflow) [../deps/mpg123/src/output/coreaudio.c:81] warning: Didn't have any audio data in callback (buffer underflow) [../deps/mpg123/src/output/coreaudio.c:81] warning: Didn't have any audio data in callback (buffer underflow)

Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000 0x0000360b14f245b9 in ?? () (gdb) bt

0 0x0000360b14f245b9 in ?? ()

1 0x0000360b14f118b7 in ?? ()

2 0x000000010018a28c in v8::internal::Invoke ()

3 0x0000000100146364 in v8::Function::Call ()

4 0x00000001021055b4 in read_delivered_music (handle=<value temporarily unavailable, due to optimizations>, status=<value temporarily unavailable, due to optimizations>) at ../src/player.cc:132

5 0x000000010012f60c in uv__run_timers ()

6 0x0000000100125f7e in uv_run ()

7 0x000000010000c6e3 in node::Start ()

8 0x00000001000039f4 in start ()

(gdb)

— Reply to this email directly or view it on GitHubhttps://github.com/Floby/node-libspotify/issues/41#issuecomment-26767967 .

LinusU commented 11 years ago

coreaudio.c is from node-speaker, however, I don't think that the problem lies there. This is just what I think and I might be totally wrong:

#3 0x0000000100146364 in v8::Function::Call () Is player.cc line 132, where it calls into this._session._sp_session.music_delivery which I think is #1 which just forwards the call to Node.js Readable stream which actually uses the buffer (#0). When the buffer is read it tries to read it from address 0 (NULL) which of course results in EXC_BAD_ACCESS.

So I think that somehow we create the buffer with a NULL pointer...

Floby commented 11 years ago

That's unfortunate... ^^

On 22 October 2013 15:38, Linus Unnebäck notifications@github.com wrote:

coreaudio.c is from node-speaker, however, I don't think that the problem lies there. This is just what I think and I might be totally wrong:

3 0x0000000100146364 in v8::Function::Call () Is player.cc line 132,

where it calls into this._session._sp_session.music_delivery which I think is #1 which just forwards the call to Node.js Readable stream which actually uses the buffer (#0). When the buffer is read it tries to read it from address 0 (NULL) which of course results in EXC_BAD_ACCESS.

So I think that somehow we create the buffer with a NULL pointer...

— Reply to this email directly or view it on GitHubhttps://github.com/Floby/node-libspotify/issues/41#issuecomment-26803169 .

Floby commented 11 years ago

As I've said, I should be able to get more time to work on this next week.

On 22 October 2013 17:41, Florent JABY florent.jaby@gmail.com wrote:

That's unfortunate... ^^

On 22 October 2013 15:38, Linus Unnebäck notifications@github.com wrote:

coreaudio.c is from node-speaker, however, I don't think that the problem lies there. This is just what I think and I might be totally wrong:

3 0x0000000100146364 in v8::Function::Call () Is player.cc line 132,

where it calls into this._session._sp_session.music_delivery which I think is #1 which just forwards the call to Node.js Readable stream which actually uses the buffer (#0). When the buffer is read it tries to read it from address 0 (NULL) which of course results in EXC_BAD_ACCESS.

So I think that somehow we create the buffer with a NULL pointer...

— Reply to this email directly or view it on GitHubhttps://github.com/Floby/node-libspotify/issues/41#issuecomment-26803169 .

LinusU commented 11 years ago

Yeah, no worries. I'll look at aswell if I get the time.

IainCole commented 9 years ago

I have made a change in this commit that should hopefully address this issue, I'm still testing it for a while but it seems to do the trick so far. I'll create a PR once I'm happy that it has actually fixed it. https://github.com/IainCole/node-libspotify/commit/85a2cddd9ecac62e419ce4c227e2c53b3ad207eb

IainCole commented 9 years ago

Looks like this didn't work :(

IainCole commented 9 years ago

This one https://github.com/IainCole/node-libspotify/commit/ec2fbc544b7b126e75b615839efd9b9fab05fec4 might work better though

tim-gp commented 9 years ago

Did it Iain?

IainCole commented 9 years ago

I still get a segfault in my particular app but I don't get this error any more and it's much more stable, so I think it worked for fixing this issue. I haven't been able to get to the root cause of my other issue though so there might still be something wrong.