Stop a Gem running an endless FFI loop

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Stop a Gem running an endless FFI loop

GLASS mailing list
Hi,
GS: 337
Which is the best way to stop a Gem running an endless FFI loop ?
Let's say Gem1 starts Gem2 that runs the FFI loop.

The FFI Gem2 is started like (inside Gem1):
s := GsExternalSession new.
s username: 'xx'; password: 'xx'; login.
s forkString: 'FFI endless loop here'.

So far so good..
But when i try to stop it with:
System stopSession: s sessionId. (in Gem1)
the command: netstat -lpn | grep 6060 - it shows the gem still running on that port. So Gem2 still running
Gem2 only ends if I logout from Gem1.

Also tried to use #forceLogout but sometime works fine but other answer the following error:
'session with stone session ID of 127 still present 20 seconds after logout'

And last question is:
Which is the difference between GsExternalSessio>>sessionId and  GsExternalSession>>stoneSessionId ?

Right now the kill is done with:
System performOnServer: 'kill -9 ' , s gemProcessId printString

_______________________________________________
Glass mailing list
[hidden email]
https://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: Stop a Gem running an endless FFI loop

GLASS mailing list
Bruno,

Here's the response from engineering:
  If you have hot loop in C code called from the FFI ,
  you will have to  use either kill -TERM or kill -9 .

We plan to talk over possible new features later this week ...

Dale

On May 5 2021, at 12:13 pm, Bruno Buzzi Brassesco via Glass <[hidden email]> wrote:
Hi,
GS: 337
Which is the best way to stop a Gem running an endless FFI loop ?
Let's say Gem1 starts Gem2 that runs the FFI loop.

The FFI Gem2 is started like (inside Gem1):
s := GsExternalSession new.
s username: 'xx'; password: 'xx'; login.
s forkString: 'FFI endless loop here'.

So far so good..
But when i try to stop it with:
System stopSession: s sessionId. (in Gem1)
the command: netstat -lpn | grep 6060 - it shows the gem still running on that port. So Gem2 still running
Gem2 only ends if I logout from Gem1.

Also tried to use #forceLogout but sometime works fine but other answer the following error:
'session with stone session ID of 127 still present 20 seconds after logout'

And last question is:
Which is the difference between GsExternalSessio>>sessionId and  GsExternalSession>>stoneSessionId ?

Right now the kill is done with:
System performOnServer: 'kill -9 ' , s gemProcessId printString
_______________________________________________
Glass mailing list
https://lists.gemtalksystems.com/mailman/listinfo/glass

_______________________________________________
Glass mailing list
[hidden email]
https://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: Stop a Gem running an endless FFI loop

GLASS mailing list
Dale,

Actually is a Smalltalk loop but each iteration calls a FFI function, that maybe does or does NOT return.

regards,
bruno

El mié, 5 may 2021 a las 19:00, Dale Henrichs (<[hidden email]>) escribió:
Bruno,

Here's the response from engineering:
  If you have hot loop in C code called from the FFI ,
  you will have to  use either kill -TERM or kill -9 .

We plan to talk over possible new features later this week ...

Dale

On May 5 2021, at 12:13 pm, Bruno Buzzi Brassesco via Glass <[hidden email]> wrote:
Hi,
GS: 337
Which is the best way to stop a Gem running an endless FFI loop ?
Let's say Gem1 starts Gem2 that runs the FFI loop.

The FFI Gem2 is started like (inside Gem1):
s := GsExternalSession new.
s username: 'xx'; password: 'xx'; login.
s forkString: 'FFI endless loop here'.

So far so good..
But when i try to stop it with:
System stopSession: s sessionId. (in Gem1)
the command: netstat -lpn | grep 6060 - it shows the gem still running on that port. So Gem2 still running
Gem2 only ends if I logout from Gem1.

Also tried to use #forceLogout but sometime works fine but other answer the following error:
'session with stone session ID of 127 still present 20 seconds after logout'

And last question is:
Which is the difference between GsExternalSessio>>sessionId and  GsExternalSession>>stoneSessionId ?

Right now the kill is done with:
System performOnServer: 'kill -9 ' , s gemProcessId printString
_______________________________________________
Glass mailing list

_______________________________________________
Glass mailing list
[hidden email]
https://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: Stop a Gem running an endless FFI loop

GLASS mailing list
Once you “fork” a string or block in GsExternalSession, the appropriate way to interrupt the Smalltalk code is with a break. Look for GsExternalSession>>#’softBreak’. After that you need to check for a result and get the result. Once the execution finishes (with an answer or an exception, including a break), then you can send another request or logout.

James

On May 5, 2021, at 3:15 PM, Bruno Buzzi Brassesco via Glass <[hidden email]> wrote:

Dale,

Actually is a Smalltalk loop but each iteration calls a FFI function, that maybe does or does NOT return.

regards,
bruno

El mié, 5 may 2021 a las 19:00, Dale Henrichs (<[hidden email]>) escribió:
Bruno,

Here's the response from engineering:
  If you have hot loop in C code called from the FFI ,
  you will have to  use either kill -TERM or kill -9 .

We plan to talk over possible new features later this week ...

Dale

On May 5 2021, at 12:13 pm, Bruno Buzzi Brassesco via Glass <[hidden email]> wrote:
Hi,
GS: 337
Which is the best way to stop a Gem running an endless FFI loop ?
Let's say Gem1 starts Gem2 that runs the FFI loop.

The FFI Gem2 is started like (inside Gem1):
s := GsExternalSession new.
s username: 'xx'; password: 'xx'; login.
s forkString: 'FFI endless loop here'.

So far so good..
But when i try to stop it with:
System stopSession: s sessionId. (in Gem1)
the command: netstat -lpn | grep 6060 - it shows the gem still running on that port. So Gem2 still running
Gem2 only ends if I logout from Gem1.

Also tried to use #forceLogout but sometime works fine but other answer the following error:
'session with stone session ID of 127 still present 20 seconds after logout'

And last question is:
Which is the difference between GsExternalSessio>>sessionId and  GsExternalSession>>stoneSessionId ?

Right now the kill is done with:
System performOnServer: 'kill -9 ' , s gemProcessId printString
_______________________________________________
Glass mailing list
_______________________________________________
Glass mailing list
[hidden email]
https://lists.gemtalksystems.com/mailman/listinfo/glass


_______________________________________________
Glass mailing list
[hidden email]
https://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: Stop a Gem running an endless FFI loop

GLASS mailing list
James,
Thank you for the answer.
This approach only works in some cases, I think it depends on the behavior of the called FFI function.
Also tried with #hardBreak but also not always works.

For now I will keep:
kill -9 pid

regards,
bruno

El mié, 5 may 2021 a las 19:39, James Foster (<[hidden email]>) escribió:
Once you “fork” a string or block in GsExternalSession, the appropriate way to interrupt the Smalltalk code is with a break. Look for GsExternalSession>>#’softBreak’. After that you need to check for a result and get the result. Once the execution finishes (with an answer or an exception, including a break), then you can send another request or logout.

James

On May 5, 2021, at 3:15 PM, Bruno Buzzi Brassesco via Glass <[hidden email]> wrote:

Dale,

Actually is a Smalltalk loop but each iteration calls a FFI function, that maybe does or does NOT return.

regards,
bruno

El mié, 5 may 2021 a las 19:00, Dale Henrichs (<[hidden email]>) escribió:
Bruno,

Here's the response from engineering:
  If you have hot loop in C code called from the FFI ,
  you will have to  use either kill -TERM or kill -9 .

We plan to talk over possible new features later this week ...

Dale

On May 5 2021, at 12:13 pm, Bruno Buzzi Brassesco via Glass <[hidden email]> wrote:
Hi,
GS: 337
Which is the best way to stop a Gem running an endless FFI loop ?
Let's say Gem1 starts Gem2 that runs the FFI loop.

The FFI Gem2 is started like (inside Gem1):
s := GsExternalSession new.
s username: 'xx'; password: 'xx'; login.
s forkString: 'FFI endless loop here'.

So far so good..
But when i try to stop it with:
System stopSession: s sessionId. (in Gem1)
the command: netstat -lpn | grep 6060 - it shows the gem still running on that port. So Gem2 still running
Gem2 only ends if I logout from Gem1.

Also tried to use #forceLogout but sometime works fine but other answer the following error:
'session with stone session ID of 127 still present 20 seconds after logout'

And last question is:
Which is the difference between GsExternalSessio>>sessionId and  GsExternalSession>>stoneSessionId ?

Right now the kill is done with:
System performOnServer: 'kill -9 ' , s gemProcessId printString
_______________________________________________
Glass mailing list
_______________________________________________
Glass mailing list
[hidden email]
https://lists.gemtalksystems.com/mailman/listinfo/glass


_______________________________________________
Glass mailing list
[hidden email]
https://lists.gemtalksystems.com/mailman/listinfo/glass