Re: Safely timing out DBI queries

2006-09-19 Thread Chuck Fox
I realize that this is very specific to the database, however, it may be possible to set a resource limit at the database level that will prevent the queries from consuming too much time. Chuck [EMAIL PROTECTED] wrote: On Sep 18, 2006, at 6:18 PM, Tyler MacDonald wrote: Dean Arnold [EMAIL

Re: Safely timing out DBI queries

2006-09-19 Thread michael . peppler
, dbi-dev Subject:Re: Safely timing out DBI queries I realize that this is very specific to the database, however, it may be possible to set a resource limit at the database level that will prevent the queries from consuming too much time. Chuck [EMAIL PROTECTED] wrote: On Sep 18, 2006

Re: Safely timing out DBI queries

2006-09-19 Thread Sam Tregar
On Tue, 19 Sep 2006 [EMAIL PROTECTED] wrote: And some drivers have a timeout parameter that handles this issue at the vendor API level (e.g. DBD::Sybase's timeout parameter that is handled internally by OpenClient). Good to know. I'm looking into adding something like this to MySQL, but

Re: Safely timing out DBI queries

2006-09-18 Thread Tim Bunce
On Sun, Sep 17, 2006 at 10:59:48AM -0700, Dean Arnold wrote: (I've added dbi-dev as this seems relevant) Tim Bunce wrote: On Sat, Sep 16, 2006 at 08:31:54PM -0400, Sam Tregar wrote: On Sat, 16 Sep 2006, Dean Arnold wrote: I think your best bet might be to work with the DBD::mysql

Re: Safely timing out DBI queries

2006-09-18 Thread Dean Arnold
Tim Bunce wrote: Which brings me back to the notion of non-blocking requests. Assuming many/most client libs do support an async capability, and a OOB cancel, then it should be possible to standardize the behavior externally. Attempting to standardize, let alone implement, non-blocking

Re: Safely timing out DBI queries

2006-09-18 Thread Tyler MacDonald
Dean Arnold [EMAIL PROTECTED] wrote: Which brings me back to the notion of non-blocking requests. Assuming many/most client libs do support an async capability, and a OOB cancel, then it should be possible to standardize the behavior externally. Attempting to standardize, let alone

Re: Safely timing out DBI queries

2006-09-18 Thread Henri Asseily
On Sep 18, 2006, at 6:18 PM, Tyler MacDonald wrote: Dean Arnold [EMAIL PROTECTED] wrote: Which brings me back to the notion of non-blocking requests. Assuming many/most client libs do support an async capability, and a OOB cancel, then it should be possible to standardize the behavior

Re: Safely timing out DBI queries

2006-09-18 Thread Tyler MacDonald
Henri Asseily [EMAIL PROTECTED] wrote: The problem is not to know when a request is done processing. The problem is killing requests that are processing for too long. If you want kill them safely, you may not be able to kill them until they're done, which defeats the purpose. If you kill

Re: Safely timing out DBI queries

2006-09-17 Thread Tim Bunce
On Sat, Sep 16, 2006 at 08:31:54PM -0400, Sam Tregar wrote: On Sat, 16 Sep 2006, Dean Arnold wrote: I think your best bet might be to work with the DBD::mysql maintainers to implement some driver-specific nonblocking versions of execute/prepare (and maybe fetch), as well as support for 'out

Re: Safely timing out DBI queries

2006-09-17 Thread Henri Asseily
Also, rather than fork each time you need a timeout it would be nice to be able to have a single 'watchdog' process and use some form of fast IPC to tell it when to be active (passing the timeout to use and relevant session id) and when to be inactive. A pipe would be fine. But perhaps that

Re: Safely timing out DBI queries

2006-09-17 Thread Martin Gainty
unsubscribe immediately * This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in

Re: Safely timing out DBI queries

2006-09-17 Thread Alexander Foken
Read The Fine Mail headers which tell you how to do so! On 17.09.2006 13:47, Martin Gainty wrote: unsubscribe immediately * This email message and any files transmitted with it contain confidential information intended only

Re: Safely timing out DBI queries

2006-09-17 Thread Martin Gainty
, 2006 8:31 AM Subject: Re: Safely timing out DBI queries Read The Fine Mail headers which tell you how to do so! On 17.09.2006 13:47, Martin Gainty wrote: unsubscribe immediately * This email message and any files transmitted

Re: Safely timing out DBI queries

2006-09-17 Thread Zhivko Ivanov Duchev
-users dbi-users@perl.org Sent: Sunday, September 17, 2006 8:31 AM Subject: Re: Safely timing out DBI queries Read The Fine Mail headers which tell you how to do so! On 17.09.2006 13:47, Martin Gainty wrote: unsubscribe immediately

Re: Safely timing out DBI queries

2006-09-17 Thread Sam Tregar
On Sun, 17 Sep 2006, Tim Bunce wrote: For any driver that uses a network socket to connect you could close() the socket in the signal handler to (relatively) safely timeout. Should be fairly clean/safe for the db client library state, though unsafe signals means there's still a chance perl's

Re: Safely timing out DBI queries

2006-09-17 Thread Sam Tregar
On Sun, 17 Sep 2006, Henri Asseily wrote: This is a good way for handling a few potentially long-running queries, but forking each time means that you create a new dbh each time, correct? That's impossibly slow for environments like high-volume webservers. Right. And a few long-running

Re: Safely timing out DBI queries

2006-09-17 Thread Dean Arnold
(I've added dbi-dev as this seems relevant) Tim Bunce wrote: On Sat, Sep 16, 2006 at 08:31:54PM -0400, Sam Tregar wrote: On Sat, 16 Sep 2006, Dean Arnold wrote: I think your best bet might be to work with the DBD::mysql maintainers to implement some driver-specific nonblocking versions of

Re: Safely timing out DBI queries

2006-09-17 Thread Sam Tregar
On Sun, 17 Sep 2006, Dean Arnold wrote: Er, but how ? Unless/until the DBI is threadsafe, the only way for kill_session() to work is by breaking the DBD out of the current blocking request. Which I assume is to be accomplished by throwing signals around ? DBIx::Timeout uses a separate

Re: Safely timing out DBI queries

2006-09-17 Thread Ron Savage
On Sun, 17 Sep 2006 10:59:48 -0700, Dean Arnold wrote: Hi Dean just swallow the signal. (I'll note that signals are conclusive proof that UNIX was developed in an era when recreational narcotics were readily available and inexpensive.) The more things change, the more things stay the

Re: Safely timing out DBI queries

2006-09-16 Thread Henri Asseily
3:15 PM To: dbi-users@perl.org Subject: Safely timing out DBI queries Greetings all. I'm working on an app which allows users to construct queries using a web UI in a moderately free-form fashion. There's plenty of data and hence plenty of rope. I need to save my users from themselves

Re: Safely timing out DBI queries

2006-09-16 Thread Sam Tregar
On Sat, 16 Sep 2006, Henri Asseily wrote: Use the great Sys::SigAction by Lincoln Baxter. That's just a wrapper around POSIX sigaction(), right? As I understand it that's equivalent to the old unsafe signals in Perl before 5.8. I'd rather avoid that if it all possible! -sam

Re: Safely timing out DBI queries

2006-09-16 Thread Henri Asseily
On Sep 16, 2006, at 8:58 PM, Sam Tregar wrote: On Sat, 16 Sep 2006, Henri Asseily wrote: Use the great Sys::SigAction by Lincoln Baxter. That's just a wrapper around POSIX sigaction(), right? As I understand it that's equivalent to the old unsafe signals in Perl before 5.8. I'd rather

Re: Safely timing out DBI queries

2006-09-16 Thread Henri Asseily
On Sep 17, 2006, at 12:05 AM, Henri Asseily wrote: On Sep 16, 2006, at 8:58 PM, Sam Tregar wrote: On Sat, 16 Sep 2006, Henri Asseily wrote: Use the great Sys::SigAction by Lincoln Baxter. That's just a wrapper around POSIX sigaction(), right? As I understand it that's equivalent to the

Re: Safely timing out DBI queries

2006-09-16 Thread Sam Tregar
On Sun, 17 Sep 2006, Henri Asseily wrote: You've got a catch-22: If you ALWAYS want the signal to fire on time, then you should expect unsafe signals. Just clean up after yourself. It's hard to clean up after the kind of problems unsafe signals can cause. For example, imagine the DB client

Re: Safely timing out DBI queries

2006-09-16 Thread Dean Arnold
I'm not really qualified to comment on DBD::mysql, but... I just saw your note on mysql internals, and suspect your request there is unlikely to be given serious consideration. I think your best bet might be to work with the DBD::mysql maintainers to implement some driver-specific nonblocking

Re: Safely timing out DBI queries

2006-09-16 Thread Sam Tregar
On Sat, 16 Sep 2006, Dean Arnold wrote: I just saw your note on mysql internals, and suspect your request there is unlikely to be given serious consideration. Always a possibility. Maybe they'd be more interested in a patch. (For the curious, I wrote a message to the MySQL internals

Safely timing out DBI queries

2006-09-15 Thread Sam Tregar
Greetings all. I'm working on an app which allows users to construct queries using a web UI in a moderately free-form fashion. There's plenty of data and hence plenty of rope. I need to save my users from themselves by timing-out long-running queries and killing the MySQL thread. Our first

RE: Safely timing out DBI queries

2006-09-15 Thread CAMPBELL, BRIAN D (BRIAN)
nameless. -Original Message- From: Sam Tregar [mailto:[EMAIL PROTECTED] Sent: Friday, September 15, 2006 3:15 PM To: dbi-users@perl.org Subject: Safely timing out DBI queries Greetings all. I'm working on an app which allows users to construct queries using a web UI in a moderately free-form