sw17ch / portaudio

Haskell bindings to the portaudio library.
MIT License
10 stars 5 forks source link

portaudio segfaults iff compiled #3

Open dancor opened 12 years ago

dancor commented 12 years ago

For a simple sawtooth wave using the blocking IO approach, I'm getting a segfault iff I compile: https://gist.github.com/3520964

I'm not sure if this is related to me being on a 64-bit machine?

avaitla commented 12 years ago

Thanks for the example. I will look into it this week.

dancor commented 12 years ago

Thank you! I'm still working on my FFI savviness, I wish I could help debug it more.

On Fri, Aug 31, 2012 at 9:06 PM, Anil notifications@github.com wrote:

Thanks for the example. I will look into it this week.

— Reply to this email directly or view it on GitHubhttps://github.com/sw17ch/portaudio/issues/3#issuecomment-8208759.

hanshoglund commented 11 years ago

Same problem here. Running this on OS X 10.7 (64-bit) crashes when compiled but works nice with runhaskell.

dancor commented 11 years ago

Still seeing the same behavior with newer Linux and GHC:

avaitla commented 10 years ago

@potat0 submitted this great patch which seems to fix your issue on my machine by no longer segfaulting @dancor https://github.com/sw17ch/portaudio/pull/5. Confirm if you have a chance.

I think there is still something wrong with the other example, which needs more investigation @hanshoglund

dancor commented 10 years ago

Yes it worked: on my gist above, still on 64-bit Ubuntu, the sawtooth wave plays, then the program exits with no segfault, under both compilation and runghc. Thank you very much everyone!

I am also seeing that hanshoglund's gist still segfaults under compilation only.

raymoo commented 9 years ago

I'm getting this error when compiling, but only when I set the suggested latency low. I was using the defaultLowOutputLatency, which was around 8ms. Here's a minimal breaking example (at least on my machine): http://lpaste.net/142590. It stops segfaulting if I have no callback, but it still crashes with this trivial callback. So maybe it has something to do with how portaudio calls back into haskell?

EDIT: I noticed this only happens for me on low latencies. If I set the latency to 0.1 or 0.05 it doesn't segfault for me.

Also forgot to mention I'm doing this on a Debian x64 system with GHC 7.10.2.

EDIT2: I don't get the issues when compiling with threaded runtime