Weird broken pipe error on linux

Sometimes when I start the game up my console gets spammed by line
pa_write() failed while trying to wake up the mainloop: Broken pipe
In a moment of running (simpleInitApp() is not executed sucessfully) the game crashes with a NullPointer.
The point here is that the error happens only sometimes. Usually it works, but sometimes it crashes like that. It’s the frequency of this crash increasing that made me type this up. The error doesn’t appear on the same machine, but with Windows booted.

Googling that line found pretty much nothing so I don’t even know what component (audio, graphics…) it comes from.

I’m on Ubuntu 16.04 LTS.

I might be wrong, but the pa_* function makes me think it might have something to do with the infamous pulseaudio.

It is almost undoubtedly *nix related…

Have you tried to use a more current unix? Might be that that problem is already fixed upstream.

@jayfella definitely, since it works on win no problem.

@Empire_Phoenix No, I haven’t since I only have dual boot (win/ubuntu) machine. I guess I could try updating to 16.10, but I don’t feel like trying out another distro.

From initial investigation it’s defnitely pulse audio and it relates to other programs not letting go of the device correctly. Since this isnt hugely common, I’m guessing it’s probably something related to your PC specifically - or rather - something you are doing specifically. Do you by any chance have any streaming services running (youtube, video players, maybe even music) at the time or before running your game instance? This is all presumption but from the description it sounds like a third-party is hogging the audio device and not giving the resources back.

On the Linux computer that my wife and kids have shared for some time (Linux Mint 13 maybe?), firefox + flash death-gripping the audio was such a problem that even my daughter at 7 years old knew how to hunt down the user that still had firefox running to kill it. (And even to reboot the machine if that didn’t work.)

I’d say Linux still does some pretty dodgy things pointing to audio as an example… but Windows has done some screwy things, too, in that department. (Still, it bothers me a bunch that I can’t get JACK to work on Linux Mint 17.)

Over all linux is awesome. However the sound system has been a problem on and off for a very long time. I don’t really like pulse audio, but at least now we seem to have converged to one system and we can fix it over time.

One reason i use slack it that over the years it has been the only one to get sound right out of the box. Currently with pulse audio i run different sound streams at different levels to blue tooth, ear phones the speakers and a USB headset without issues.

But i still get the odd issue with Chrome hogging a device and not giving it up. However it is weird to have a NPE and a crash. Typically sound just wont work.

Have you tried without sound enabled. or sound off?

You could try a test with pulse disabled (use ALSA) to be sure that’s the issue, no new distro needed for that.

sudo nano /etc/pulse/client.conf

; autospawn = yes

Remove ; and change to no, restart.

Many curse at pulse as the source of various issues.

Ok, will try. It will be difficult to test though, since it only happens sometimes.

Confirmed, flash on certain moments (correlated to highest CPU load) hangs my audio so I have to kill one or both browsers (and quit JME btw, since OpenAL initialized) to reset it. Thank gods, no complete reboot needed.

1 Like

I’ve noticed some pretty bad crashes and upsets on Windows 10 when i make a threadpool that has a size of all cores - and then do some intensive work. Kinda makes sense - the CPU gets completely over-worked and leaves no time for the OS or main loop - but it took me a while to figure it out. Lesson learned: make a threadpool of maximum size coreCount - 1.

Then windows 10 has serious problems, or your code somehow does.

I routinely run 200-300 thread processes on Windows 7 that are hammering things and don’t have crash problems. An OS that crashes just because you use too much CPU is really broken at a fundamental level.

I’ve never experienced it before Windows 10 - I’ve done the same. My PC would random blue-screen and reboot - major nightmare when you’re trying to get things done. I kept altering my overclock, giving it a little bit more juice, lowering it, etc. Running burn-in tests overnight, etc, but they all passed happily. Then I run my game, and it was generating say 5000 chunks - which hogged the pool for maybe a minute or so - and boom - blue screen. On any other version it never did, so I eventually lowered the pool down one just out of blind guesswork and never had a BSOD since. Wierd. I have no answers, just a story of events :confused:

You might check for overheating of some component. I used to have this problem on a machine with a bad CPU heat sink conduction. Then again, given what you are doing with the work done by these threads and the native code involved, it could be anything from GPU drivers on up.

@grizeldi I have similar problem on my own embedded linux device
pa_write() failed while trying to wake up the mainloop: Broken pipe

Did you find the reason why?

I am also experiencing this and other relateds (like some shared memory thing (shm.c) and some file-descriptor EOF stuff).

Do you all use gradle? I am uncertain whether it’s gradle or triggered by openAL?

Edit: My workaround is killing the process and restarting.

Yeah, restarting the process usually fixes it. I don’t use gradle.

I just got Assertion 'pa_close(m->fd) == 0' failed at pulsecore/shm.c:286, function pa_shm_free(). Aborting.
I only wonder where pulsecore comes from? It seems like a native part of openAL maybe? Maybe Upgrading would help?

However it seems like it comes from a deeper layer, considering Amarok of KDE also has this bug. Do you also use Kubuntu, @grizeldi?

Edit: And yet another crash, this time it even crashed the jvm with a SIGSEV:

ALSA lib conf.c:1698:(snd_config_load1) _toplevel_:192:26:Unexpected char
ALSA lib conf.c:3819:(snd_config_update_r) /usr/share/alsa/alsa.conf may be old or corrupted: consider to remove or fix it
AL lib: (EE) alsa_open_playback: Could not open playback device 'default': Das Argument ist ungültig

Nope, regular Ubuntu here.