Debugging BASS

Started by Chris Oakley,

Chris Oakley

I suspect there could be an issue with Audio Over IP (AoIP) setups like Wheatstone, AXIA etc. We are experiencing application crashes very often on AoIP systems in either the KERNELBASE.dll or CLR.dll. We've done all the usual, setting up CrashDumps etc, but we're not getting actual lines where our applications are crashing.

We've had situations where the audio has just stopped playing mid song and trying to get something else to play crashes our application.

We're not seeing this outside of AoIP setups, but it's not all AoIP setups, just a select number.

My thoughts right now are something is happening that we can't see or monitor and I wondered if there is a debug version of BASS or some way we can drill down a little further to see if something on these setups is upsetting BASS.

Ian @ un4seen

There isn't a single debug BASS version for all scenarios, but rather custom case-specific debug versions to log/check relevant things (to avoid unnecessarily large and irrelevant logs). To find out if such a debug BASS version would be helpful in this case, please upload a few dump files (zipped) to have a look at here:

    ftp://ftp.un4seen.com/incoming/

Chris Oakley

Thanks Ian. When you say dump files, are you asking for crash dumps?

The most recent hang up in the application didn't create a crash, it just stopped playing the audio. It was playing a song and then it just paused haflway through. Since it's playing via the NoSound device this has to be something related to BASS, because it wouldn't then play anything else after that until we restarted the app.

It was playing a file from a server on the network, but if it was a momentary failure, i.e. the server went away briefly, I would expect it to be able to play a file after it came back.

Ian @ un4seen

Quote from: Chris OakleyWhen you say dump files, are you asking for crash dumps?

Yes, .DMP files. If you'll be generating new dump files, please use the latest BASS build when doing so:

    www.un4seen.com/stuff/bass.zip

Quote from: Chris OakleyThe most recent hang up in the application didn't create a crash, it just stopped playing the audio. It was playing a song and then it just paused haflway through. Since it's playing via the NoSound device this has to be something related to BASS, because it wouldn't then play anything else after that until we restarted the app.

It was playing a file from a server on the network, but if it was a momentary failure, i.e. the server went away briefly, I would expect it to be able to play a file after it came back.

Please check what BASS_IsStarted says about the "No Sound" device at that point, and what BASS_ChannelIsActive says about the song's stream. If it's playing through a mixer, also do the same for the mixer. And if that's going through another mixer then do the same for that. Basically, check the status of everything between the song and the device to hopefully find the origin of the problem.

Chris Oakley

Thanks Ian. I've started to add this logging in so every 60 seconds it outputs everything it can.

I'm a bit puzzled however, everything is running as expected, but this:
Bass.BASS_SetDevice(0)
Dim _active As Integer = Bass.BASS_IsStarted()

is returning 2 - which according to the documentation is it's inactive with nothing playing - but it is playing.

BASS_CONFIG_DEV_NONSTOP is disabled but it is playing so surely this should be returning 1.

This isn't on a broken machine by the way, this is just me testing it.

Ian @ un4seen

Do you have multiple devices initialized? If so, perhaps playback is actually happening on a different one. What does BASS_ChannelGetDevice say about that? If you're playing through a mixer then it's the mixer's device that you should check. Basically, check whatever handle(s) you're using in BASS_ChannelPlay/Start calls.

Chris Oakley

I do have multiple devices. I always have something outputting to NOSOUND though so I'm surprised that it's not showing as playing.

Ian @ un4seen

Is BASS_IsStarted always returning 2? There may a very small delay (I'd expect under 1ms) before it returns 1 after you start playing something on the device, but it shouldn't be possible for it to keep returning 2 indefinitely while playing. If it is always returning 2 then please do check the BASS_ChannelGetDevice value(s).

Chris Oakley

The Bass.BASS_ChannelGetDevice is returning 0 which is NOSOUND, so I'm still puzzled as to why when something is playing that the BASS_IsStarted is returning 2.

I log all this out every 60 seconds, so when it happens, something is definately playing and has been for a time.

I'm using BASS 2.4.17.4

Chris Oakley

So this morning the app has hung mid song but it is still responsive. The player is just stuck. I've checked the logging and everything is normal. The file stream it's playing is being reported as active and playing BASS_ACTIVE_PLAYING

The mixer that it's being played on is BASS_ACTIVE_PLAYING and the mixer that is plugged into is BASS_ACTIVE_PLAYING as well.

The only outstanding puzzle is the NOSOUND showing IsStarted as 2, but that hasn't changed from when it was working to it now hanging up.

Another interesting point is that I had two instances of the application running. The one that is now stuck and the other, which wasn't doing anything specific, it was just sat there. The idle application won't allow me to play anything on it either now. If I try it just locks up the app completely.

The LiveWire AXIA sound device appears to be working fine now.

Ian @ un4seen

Quote from: Chris OakleyThe Bass.BASS_ChannelGetDevice is returning 0 which is NOSOUND, so I'm still puzzled as to why when something is playing that the BASS_IsStarted is returning 2.

I log all this out every 60 seconds, so when it happens, something is definately playing and has been for a time.

I'm using BASS 2.4.17.4

Ah. I think that BASS_IsStarted=2 on the "No Sound" device may actually be a bug in the BASS 2.4.17 release that has since been fixed. Please try the latest build and see if you still have that issue:

    www.un4seen.com/stuff/bass.zip

If that issue is gone now, please recheck things when the audio stops. As well as BASS_ChannelIsActive, you could also check BASS_ChannelGetPosition to see if the positions are still advancing when the problem occurs.

Chris Oakley

I've not explored these suggestions just yet because I think we may have found out the cause.

The files are being played via a network share and when we see the problem we find we cannot access the share. Normally in Windows if you try to navigate to a share that isn't available it will tell you that it's not there. For example you go to Run and target the share, it opens File Explorer in the share.

However, in this very unique scenario, if you try to access the share the process never returns. It hangs. You never get a message box saying it's unavailable and File Explorer never opens.

In a normal situation where the share vanishes because the machine hosting the share has restarted, BASS would error as the file it was accessing has now gone.

In this situation, from what I can tell, BASS just hangs like something is happening, but it isn't.

It's something to do with SMB Redirector from initial digging, but this is very much still new information.

Ian @ un4seen

Quote from: Chris OakleyIn this situation, from what I can tell, BASS just hangs like something is happening, but it isn't.

I suspect a read operation on the network file is stuck waiting for the network to return (rather than immediately failing). If you can provide a dump file from it (you can generate one in Task Manager), I'll check whether that's the case.

Does playback resume when the network is back up? Or does the app eventually stop hanging anyway, eg. after some timeout elapses?

Chris Oakley

It never comes back so we don't know. At this stage all we can do is restart the PC. If the PC dies again before the client wipes it then I'll grab a dump.

Ian @ un4seen

Oh, the system (not just the app) needs to be restarted before anything works again? In that case, it sound like a pretty catastrophic failure that you won't be able to do anything about in your app, unfortunately.

Chris Oakley

That's what I thought. Sadly the client has wiped the machine clean now and is planning to wipe their server and reinstall everything.

We'll have to draw a line under this since it's not a reproducable problem but thanks for your input Ian. It's appreciated as always  :)