You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Markus Jelsma <ma...@buyways.nl> on 2010/02/02 10:12:58 UTC
Stopping externals
Hi,
Is it normal behaviour for external scripts to continue running after i have
either killed CouchDB by hand or kindly used provided init scripts?
At least, the Lounge's replicator will continue running until i force it down
manually. Is killing an external process something CouchDB should be
responsible for?
Cheers,
Markus Jelsma - Technisch Architect - Buyways BV
http://www.linkedin.com/in/markus17
050-8536620 / 06-50258350
Re: Stopping externals
Posted by Troy Kruthoff <tk...@gmail.com>.
The external script is responsible for detecting that the stdin/out
pipe was closed. We coded a few ext scripts and had to bake this in,
pseudo code:
while STDIN do work unless STDIN.EOF
Troy
On Feb 2, 2010, at 1:12 AM, Markus Jelsma wrote:
> Hi,
>
>
> Is it normal behaviour for external scripts to continue running
> after i have
> either killed CouchDB by hand or kindly used provided init scripts?
>
> At least, the Lounge's replicator will continue running until i
> force it down
> manually. Is killing an external process something CouchDB should be
> responsible for?
>
>
> Cheers,
>
> Markus Jelsma - Technisch Architect - Buyways BV
> http://www.linkedin.com/in/markus17
> 050-8536620 / 06-50258350
>
Re: Stopping externals
Posted by Paul Davis <pa...@gmail.com>.
On Fri, Feb 12, 2010 at 4:09 PM, Damien Katz <da...@apache.org> wrote:
> Haven't been following the whole discussion, but if the erlang vm is crashed and restarted, then the child process are not forcibly killed. So it's up to the child processes to terminate themselves in that case, even with the spawnkillable stuff.
>
> -Damien
Good point.
Re: Stopping externals
Posted by Damien Katz <da...@apache.org>.
Haven't been following the whole discussion, but if the erlang vm is crashed and restarted, then the child process are not forcibly killed. So it's up to the child processes to terminate themselves in that case, even with the spawnkillable stuff.
-Damien
On Feb 12, 2010, at 1:05 PM, Randall Leeds wrote:
> It looks like lounge is *almost* doing the right thing.
> Couchspawnkillable should be killing it, so it's strange that it hangs around.
>
> I added a little fix that should try to signal the background thread
> to stop when sys.in shut downs.
> Give the version on this new branch a try, please:
> http://github.com/tilgovi/couchdb-lounge/raw/replicatorshutdown/replicator/replication_notifier.py
>
> Randall
>
> On Fri, Feb 12, 2010 at 04:26, Markus Jelsma <ma...@buyways.nl> wrote:
>> Hi Paul,
>>
>>
>> CouchDB 0.10 does seem to have couchspawnkillable;
>> couch-1 [~/apache-couchdb-0.10.0] # find -name "couchspawnkillable*"
>> ./src/couchdb/priv/couchspawnkillable_win.c
>> ./src/couchdb/priv/couchspawnkillable
>> ./src/couchdb/priv/couchspawnkillable.sh
>> ./src/couchdb/priv/.deps/couchspawnkillable_win.Po
>>
>> Can you confirm this is the desired output?
>>
>> Anyway, if so there might probably be a bug then because the replicator does
>> not quit with CouchDB. I am not entirely sure whether the replicator checks
>> for a terminating pipe but i guess it does.
>>
>> Here is the Python code that sits in the main loop:
>> stuff = sys.stdin.readline()
>> if not stuff:
>> return
>>
>> Perhaps a lounge developer can tell us whether the replicator actually behaves
>> as Troy suggested.
>>
>>
>> Cheers,
>>
>>
>>> Don't recall when that came in. To check:
>>>
>>> $ find $PREFIX/lib/couchdb -name "couchspawnkillable*"
>>>
>>> If that finds something then it should be new enough to theoretically
>>> kill things.
>>>
>>> Also, you should still use Troy's pattern for reading from stdin to be
>>> well behaved for the case that we have a bug. :)
>>>
>>> HTH,
>>> Paul Davis
>>>
>>> Managed to forget the ML in my reply.
>>
>>
>> Markus Jelsma - Technisch Architect - Buyways BV
>> http://www.linkedin.com/in/markus17
>> 050-8536620 / 06-50258350
>>
>>
Re: Fwd: Stopping externals
Posted by Randall Leeds <ra...@gmail.com>.
It looks like lounge is *almost* doing the right thing.
Couchspawnkillable should be killing it, so it's strange that it hangs around.
I added a little fix that should try to signal the background thread
to stop when sys.in shut downs.
Give the version on this new branch a try, please:
http://github.com/tilgovi/couchdb-lounge/raw/replicatorshutdown/replicator/replication_notifier.py
Randall
On Fri, Feb 12, 2010 at 04:26, Markus Jelsma <ma...@buyways.nl> wrote:
> Hi Paul,
>
>
> CouchDB 0.10 does seem to have couchspawnkillable;
> couch-1 [~/apache-couchdb-0.10.0] # find -name "couchspawnkillable*"
> ./src/couchdb/priv/couchspawnkillable_win.c
> ./src/couchdb/priv/couchspawnkillable
> ./src/couchdb/priv/couchspawnkillable.sh
> ./src/couchdb/priv/.deps/couchspawnkillable_win.Po
>
> Can you confirm this is the desired output?
>
> Anyway, if so there might probably be a bug then because the replicator does
> not quit with CouchDB. I am not entirely sure whether the replicator checks
> for a terminating pipe but i guess it does.
>
> Here is the Python code that sits in the main loop:
> stuff = sys.stdin.readline()
> if not stuff:
> return
>
> Perhaps a lounge developer can tell us whether the replicator actually behaves
> as Troy suggested.
>
>
> Cheers,
>
>
>>Don't recall when that came in. To check:
>>
>>$ find $PREFIX/lib/couchdb -name "couchspawnkillable*"
>>
>>If that finds something then it should be new enough to theoretically
>>kill things.
>>
>>Also, you should still use Troy's pattern for reading from stdin to be
>>well behaved for the case that we have a bug. :)
>>
>>HTH,
>>Paul Davis
>>
>>Managed to forget the ML in my reply.
>
>
> Markus Jelsma - Technisch Architect - Buyways BV
> http://www.linkedin.com/in/markus17
> 050-8536620 / 06-50258350
>
>
Re: Fwd: Stopping externals
Posted by Markus Jelsma <ma...@buyways.nl>.
Hi Paul,
CouchDB 0.10 does seem to have couchspawnkillable;
couch-1 [~/apache-couchdb-0.10.0] # find -name "couchspawnkillable*"
./src/couchdb/priv/couchspawnkillable_win.c
./src/couchdb/priv/couchspawnkillable
./src/couchdb/priv/couchspawnkillable.sh
./src/couchdb/priv/.deps/couchspawnkillable_win.Po
Can you confirm this is the desired output?
Anyway, if so there might probably be a bug then because the replicator does
not quit with CouchDB. I am not entirely sure whether the replicator checks
for a terminating pipe but i guess it does.
Here is the Python code that sits in the main loop:
stuff = sys.stdin.readline()
if not stuff:
return
Perhaps a lounge developer can tell us whether the replicator actually behaves
as Troy suggested.
Cheers,
>Don't recall when that came in. To check:
>
>$ find $PREFIX/lib/couchdb -name "couchspawnkillable*"
>
>If that finds something then it should be new enough to theoretically
>kill things.
>
>Also, you should still use Troy's pattern for reading from stdin to be
>well behaved for the case that we have a bug. :)
>
>HTH,
>Paul Davis
>
>Managed to forget the ML in my reply.
Markus Jelsma - Technisch Architect - Buyways BV
http://www.linkedin.com/in/markus17
050-8536620 / 06-50258350
Fwd: Stopping externals
Posted by Paul Davis <pa...@gmail.com>.
On Tue, Feb 2, 2010 at 12:34 PM, Markus Jelsma <ma...@buyways.nl> wrote:
> Paul,
>
>
> My apologies, does 0.10 count as a newer version or is it 0.11/trunk? If
> not, must we then use Troy's solution?
>
Don't recall when that came in. To check:
$ find $PREFIX/lib/couchdb -name "couchspawnkillable*"
If that finds something then it should be new enough to theoretically
kill things.
Also, you should still use Troy's pattern for reading from stdin to be
well behaved for the case that we have a bug. :)
HTH,
Paul Davis
Managed to forget the ML in my reply.
Re: Stopping externals
Posted by Markus Jelsma <ma...@buyways.nl>.
Paul,
My apologies, does 0.10 count as a newer version or is it 0.11/trunk? If
not, must we then use Troy's solution?
Cheers,
Paul Davis said:
> On Tue, Feb 2, 2010 at 4:12 AM, Markus Jelsma <ma...@buyways.nl> wrote:
>> Hi,
>>
>>
>> Is it normal behaviour for external scripts to continue running after
>> i have either killed CouchDB by hand or kindly used provided init
>> scripts?
>>
>> At least, the Lounge's replicator will continue running until i force
>> it down manually. Is killing an external process something CouchDB
>> should be responsible for?
>>
>>
>> Cheers,
>>
>> Markus Jelsma - Technisch Architect - Buyways BV
>> http://www.linkedin.com/in/markus17
>> 050-8536620 / 06-50258350
>>
>>
>
> Newer versions of CouchDB should forcefully kill external processes.
>
> HTH,
> Paul Davis
Re: Stopping externals
Posted by Paul Davis <pa...@gmail.com>.
On Tue, Feb 2, 2010 at 4:12 AM, Markus Jelsma <ma...@buyways.nl> wrote:
> Hi,
>
>
> Is it normal behaviour for external scripts to continue running after i have
> either killed CouchDB by hand or kindly used provided init scripts?
>
> At least, the Lounge's replicator will continue running until i force it down
> manually. Is killing an external process something CouchDB should be
> responsible for?
>
>
> Cheers,
>
> Markus Jelsma - Technisch Architect - Buyways BV
> http://www.linkedin.com/in/markus17
> 050-8536620 / 06-50258350
>
>
Newer versions of CouchDB should forcefully kill external processes.
HTH,
Paul Davis