Subject assert firing in semapthore "fb_assert(value == 0)" via the Service destructor after calling sequence isc_service_attach, isc_service_start, isc_service_detach
Author Lee Graber


   I am running Firebird 2.5.2 on Mac OSX 10.8. I eventually plan to use the same on windows. We currently use Firbird 2.1.5 on Windows and this does not cause an assert

   We are running Firebird embedded accessing local fdb files in this scenario.

   We have created a database programmatically and after populating it, we are attempting to set the database to read only.

  After calling isc_service_attach, we call isc_service_start and indicate to set the database properties of accessmode to readonly. This call does not fail.

   When we call isc_service_detach, the underlying Service object (jrd/svc.[h|cpp]) is destroyed. The destructor is asserting because svc_sem_full is not zero (in our case it is 2). I have looked through the code at the usage of svc_sem_full & svc_sem_empty and am not totally sure about everything. It appears that they are used for handling of asynchronous services. However, even if I call isc_service_query with isc_info_svc_to_eof, it will not cause the semaphore to decrement (via enter) because there is a conditional check in the get method which looks to see if the svc is “empty” and “finished” and then does nothing. Even if did get past that, the call to svc_sem_full uses tryEnter and ignores the return so I am not sure how this is all being used.


I am not sure what to do about all of this. I can’t use isc_service_query to get past it. Is this supposed to be asserting. If the same condition, “empty” & “finished” is true, then could it not simply ignore / reset to 0 the semaphore values so that this assert does not get fired. Any advice is appreciated.