ecap service termination

Asked by joseph jose

I want to stop ecap adaptaion service when squid is turned off.
Because i am using some calls in the Adapter::Service::Stop() to stop some services running in my machine.

i just checked simply writing a text file on Service::Stop(). but its not getting executed

Question information

Language:
English Edit question
Status:
Answered
For:
eCAP Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
joseph jose (joevypana) said :
#1

i tried generating a simple test.txt file in the Adapter::Service::Start() and it works fine..

but the same that i have given in Adapter::Service::Stop() is not working.. Is there any specific directives that i should use in squid config to call the Adapter::Service::Stop(), which will get executed on squid shutdown??

Revision history for this message
Alex Rousskov (rousskov) said :
#2

What you observe is most likely a side effect of Squid bug(s). Report the problem to Squid bugzilla. When submitting your bug report, please use correct method names (e.g., stop instead of Stop).

It may take some time for the Squid Project to fix this. Meanwhile, consider moving your closing code from stop() to Service destructor. If you are lucky, the Service destructor will be called on Squid shutdown (or after reconfiguration removes the eCAP service from squid.conf).

Revision history for this message
joseph jose (joevypana) said :
#3

Thanks Alex for your suggestion.
I was stuck at that point searching for options. I will try using Service destructor.

Revision history for this message
Christof Gerber (sitschi) said :
#4

I have the same problem as stated here but it seems as if the destructor is also not called by squid in my case (neither in squid stop nor reconfigure). Actually my ecap adapter did not implement a destructor for the Service at all until lately (only for each Xaction). I found this weird from the beginning but thought this has to be like that as I started from an example. Now, I need a destructor or at least a function that is called every time when squid stop/reconfigure happens because I need to make sure that all pending async requests are freed. I have seen that ClamAV adapter has implemented a destructor. Do you know if the destructor is called reliably there? Or any other hints how to handle this destructor issue?

Revision history for this message
Alex Rousskov (rousskov) said :
#5

@joevypana, did using the Service destructor work for you?

> I have seen that ClamAV adapter has implemented a destructor. Do you know if the destructor is called reliably there?

FWIW, I do not know or remember.

> Or any other hints how to handle this destructor issue?

See my original answer dated 2014-06-05. The correct approach, IMO, is to fix the host application (if the host application is broken). Please note that the host application may not destruct the Service until there are no transactions using that service object. If you need an immediate reaction to the start of shutdown or reconfiguration, then fixing stop() is not the same as making sure the Service destructor is called.

Can you help with this problem?

Provide an answer of your own, or ask joseph jose for more information if necessary.

To post a message you must log in.