Deadlocks in a download service

Poster Content
nk4um User
Posts: 111
November 26, 2008 18:38
Hi Chris,

Yes, it solved my problem :-) Thanks for the code! I can now have a reasonable deadlock timeout, and still have also some long running requests. The only substantial change I made was the addition of a counter to cope with concurrent requests, i.e., when you start the DeadlockPreventor the counter goes one up and when you stop it one down. Only when the counter becomes zero then the preventor thread is actually killed.

For my immediate needs this works fine. But indeed you can think of nice additional functionality like you sketched. I was thinking about an approach like the gatekeeper, including a configuration file where you can specify a maximum running time for regex-based groups of requests.

Greetings,

Menzo
Like · Post Reply
nk4um User
Posts: 177
November 26, 2008 16:16Any success
Hi Menzo,

Have you had any success with this? The biggest problem I encountered with this is the problems caused by wanting to hot/cold restart during a long request and how to handle requests which may take more than a sensible amount of time. I''d like to extend what I''ve done sometime so it is more of a general purpose job system with tools to administer what is happening through a back-end interface - e.g. with a list with stop buttons. For our use, it would also be nice to be able to stop all of the requests and then start them again (e.g. to allow server restarts) and to have a queue - we''ve got a system which background compares ODT documents and then tells the user when the comparison is completed).

I might have done some more work on this since I sent Tony my partial solution, but I can''t remember! I''ll try and take a look later on!

Cheers,

Chris
Like · Post Reply
nk4um Administrator
Posts: 607
November 25, 2008 17:17example code
Hi Menzo,

I''ve forwarded you chris''s example code. Let me know how you get on.

Cheers, Tony
Like · Post Reply
nk4um User
Posts: 111
November 25, 2008 16:34
Hi Tony and Chris,

At the moment I''m trying to solve some deadlocks in my application, i.e. it runs out of threads due to too many active:exists requests. The solution would be if the number of threads is (temporarily) increased, which is what the deadlock resolver tries. But at the moment I''ve the deadlock time out pretty high as the application currently contains some long running requests. The solution you describe could help me solve this problem, as I could decrease the deadlock timeout but keep the long running requests alive. So I would be very interested in your implementation (even a partial one)!

Greetings,

Menzo
Like · Post Reply
nk4um Administrator
Posts: 607
January 18, 2008 13:39That would be great.
Thank you.
Like · Post Reply
nk4um User
Posts: 177
January 18, 2008 10:37Partial success
Hi,

I had partial success implementing this. However, I think that it could still do with some improvements - I can send what I have working later if you want?

Cheers,

Chris
Like · Post Reply
nk4um Administrator
Posts: 607
December 6, 2007 16:18Your a star!
let me know if you have any questions...
Like · Post Reply
nk4um User
Posts: 177
December 6, 2007 16:11I accept
Hi Tony,


Knowing how good you are at these things here''s a challenge ;-) .

Wrap up the functionality into a reusable service that we can roll into ext-sys. I expect it would have an URI interface like active:deadlockPreventor(Start|Stop) You could read the deadlock period from system.xml (the netkernel:config resource) to determine what the polling period should be. The logical thread of execution, so that you can have one thread per logical usage, can be determined from the com.ten60.netkernel.urrequest.URRequest.getSession().


I accept the challenge! I''ll try and use it to keep me occupied while sitting on a train tomorrow!

Cheers,

Chris
Like · Post Reply
nk4um Administrator
Posts: 607
December 3, 2007 13:03Cheeky
Hi Chris,

yes that is the recommended way. Just start and stop a thread which polls some dummy resource. It doesn''t matter if the response will be cached or even what it is. The way it works is that the kernel is tracking the time since the last request was issued.

Knowing how good you are at these things here''s a challenge ;-) .

Wrap up the functionality into a reusable service that we can roll into ext-sys. I expect it would have an URI interface like active:deadlockPreventor(Start|Stop) You could read the deadlock period from system.xml (the netkernel:config resource) to determine what the polling period should be. The logical thread of execution, so that you can have one thread per logical usage, can be determined from the com.ten60.netkernel.urrequest.URRequest.getSession().

No pressure,
Tony
Like · Post Reply
nk4um User
Posts: 177
December 3, 2007 12:17Deadlocks in a download service
We''ve implemented a NetKernel module which allows users to download from our web site - after agreeing to the terms and conditions. All works fine, until someone tries to download from our site with low bandwidth and triggers the deadlock timeout. Due to the nature of other services, I am wary of increasing the deadlock time.

Is the method discussed in http://www.1060.org/forum/topic/312 the only way of achieving this pre-nk4?

Cheers,

Chris
Like · Post Reply