Author Topic: Bassmix crashing app  (Read 188 times)

Smoodilo

  • Guest
Bassmix crashing app
« on: 21 Aug '19 - 15:36 »
Once every few days my program crashes. It took me months to narrow down the problem. And it seems to be bassmix.dll.
The program just crashes without any exception whatsoever.

The windows log shows:

Name of application with error: player.exe, versie: 1.0.0.0, timestamp: 0x5d59bc2c
Name of module with error: bassmix.DLL, version 2.4.7.2, timestamp: 0x503e0148
Exceptioncode: 0xc0000005
Errormargin: 0x00004005
Id of proces with error: 0x47b4
Starttime of program with error: 0x01d556521952689e
Path to module with error: c:\program files (x86)\player\bassmix.DLL
Rapport-id: 3713937d-c37f-11e9-8282-1c1b0d2b31cd
Full packetname with error:
Relative application-id of packet with error:



...and the details say:


- System

  - Provider

   [ Name]  Application Error
 
  - EventID 1000

   [ Qualifiers]  0
 
   Level 2
 
   Task 100
 
   Keywords 0x80000000000000
 
  - TimeCreated

   [ SystemTime]  2019-08-20T19:17:57.000000000Z
 
   EventRecordID 18227
 
   Channel Application
 
   Computer XXXX
 
   Security
 

- EventData

   player.exe
   1.0.0.0
   5d59bc2c
   bassmix.DLL
   2.4.7.2
   503e0148
   c0000005
   00004005
   47b4
   01d556521952689e
   c:\program files (x86)\player\player.exe
   c:\program files (x86)\player\bassmix.DLL
   3713937d-c37f-11e9-8282-1c1b0d2b31cd
   


What does this error mean and how to avoid it?

   

Ian @ un4seen

  • Administrator
  • Posts: 21987
Re: Bassmix crashing app
« Reply #1 on: 21 Aug '19 - 16:09 »
That's a very old version of BASSmix (from 2012). A lot has changed since then, so please try this latest build and see if the crash still happens:

   www.un4seen.com/stuff/bassmix.zip

smoodilo

  • Guest
Re: Bassmix crashing app
« Reply #2 on: 14 Sep '19 - 16:24 »
Ian,

I downloaded your latest version, and also updated all other dll's. The problem persists. The app just crashes. And Visual Studio just gives me an 'access violation'

I tried narrowing it down and it seems to be the problem is in this line of my application:

 If BassMix.BASS_Mixer_ChannelGetPosition(STREAM_MAIN1) > BassMix.BASS_Mixer_ChannelGetPosition(STREAM_MAIN2) Thenů.


The program runs for hours, days maybe, but once in a while I get this access violation without further explanation

Ian @ un4seen

  • Administrator
  • Posts: 21987
Re: Bassmix crashing app
« Reply #3 on: 16 Sep '19 - 12:17 »
Do you have a new Windows event log entry, like in the 1st post? If so, please post that.

smoodilo

  • Guest
Re: Bassmix crashing app
« Reply #4 on: 16 Sep '19 - 20:24 »


Name of app with error: player.exe, version: 1.0.0.0, timestamp: 0x5d7d06eb
Name of module with error: bass.dll, version: 2.4.14.0, timestamp: 0x5c3f4f07
Exceptioncode: 0xc0000005
Errormargin: 0x0001ffe1
Id of proces with error: 0x1fa4
Starttime of application with error: 0x01d56cc19d481039
Path \bin\Debug\player.exe
Path to module with error: \bin\Debug\bass.dll
Report-id: e2824f54-9ba9-4ccf-a677-8a9b678808c8

  <EventData>
    <Data>player.exe</Data>
    <Data>1.0.0.0</Data>
    <Data>5d7d06eb</Data>
    <Data>bass.dll</Data>
    <Data>2.4.14.0</Data>
    <Data>5c3f4f07</Data>
    <Data>c0000005</Data>
    <Data>0001ffe1</Data>
    <Data>1fa4</Data>
    <Data>01d56cc19d481039</Data>
    <Data>\bin\Debug\player.exe</Data>
    <Data>\bin\Debug\bass.dll</Data>
    <Data>e2824f54-9ba9-4ccf-a677-8a9b678808c8</Data>
    <Data>
    </Data>
    <Data>
    </Data>
  </EventData>
</Event>

Ian @ un4seen

  • Administrator
  • Posts: 21987
Re: Bassmix crashing app
« Reply #5 on: 17 Sep '19 - 14:53 »
That event log entry shows the crash was in BASS.DLL, so it's probably unrelated to your original crash. From the address of the crash, it looks like it may have been caused by a stream being freed in a mixtime BASS_SYNC_END (or perhaps BASS_SYNC_POS) sync callback function (which isn't safe to do). Are you setting any such syncs, and if so, are you calling BASS_StreamFree in the callbacks?

Smoodilo

  • Guest
Re: Bassmix crashing app
« Reply #6 on: 17 Sep '19 - 15:08 »
Yes I am.
In the EndSync I am doing

Bass_Mixer_Channelremove(chan1)
Bass_Streamfree(chan1)

Is this wrong? And even if this is, shouldn't this error be handled by bass.dll?
I get an exception in unmanaged code, so I can't try...catch this one.



Ian @ un4seen

  • Administrator
  • Posts: 21987
Re: Bassmix crashing app
« Reply #7 on: 17 Sep '19 - 15:44 »
As stated in the documentation, a stream should not be freed within its own mixtime SYNCPROC (or STREAMPROC/DSPPROC) callback function. Doing that will almost certainly result in a crash because BASS isn't finished with the stream when the callback function returns (eg. it will check for other BASS_SYNC_END syncs) but the stream's memory is no longer valid. I am considering adding delayed/asynchronous freeing in such cases but that may have other issues. For example, a stream's file wouldn't be closed immediately, which would prevent file deletion.

In your case, it looks like you want to free a stream after a mixer has finished playing it? If so, you can achieve that by using the BASS_STREAM_AUTOFREE flag in the BASS_Mixer_StreamAddChannel call instead.