OSProcess command - non responding image when calling often

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

Re: OSProcess command - non responding image when calling often

Paul DeBruicker
Hi Sabine,

I had a Pharo 5 image where running

OSProcess waitForCommand:'ls'

twice would lock everything up.

Following Gaston's suggestion here:

http://forum.world.st/Problem-with-delay-waiting-OSSubprocess-code-on-Pharo-5-0-td4895780.html#a4898158

Fixed it for me.  Maybe we hit the same issue.


Paul

Sabine Manaa wrote
Hi,

sorry but I have another issue with OSProcess.

For my app, I want to show small .png previews from my .pdfs. For this reason, I use an external software, currently pdfbox. It works fine, but regularly, I get a hanging image. I tried to reproduce it and found out, that it is not a problem with pdfbox (http://pdfbox.apache.org), because from command line, I can call it often without problems. There can be (hopefully) many users in my app with many previews at one time. So I have to call it often.

For reproduction of the OSProcess issue, I used another simple command (from my other OSProcess umlaut issue :-)) to test it.
 
calling this, results in a non responding image:
                               
20 timesRepeat: [OSProcess   command: ('cp  /Library/WebServer/Documents/reports/bar.pdf /Library/WebServer/Documents/reports/test-c.pdf').].
 
also this:
20 timesRepeat: [OSProcess   command: ('echo "Hi there"').]

My original code is similar to this but here only for information:
OSProcess
                command:
                        ('{1} -jar {2} PDFToImage -format PNG -page 1 -dpi 100 {3}'
                                format:
                                        {'Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java'.
                                        '/Users/sabine/Desktop/pdfbox-app-2.0.1.jar'.
                                        '/Library/WebServer/Documents/reports/201411121510-112859865-3378921/20150605_170_IFA_Berlin_Reisekostenabrechnung.pdf'}).


So, my question is: is it wrong, calling OSProcess like this? How to do it instead?

I am sorry to ask again and hope that there is a simple solution.
Or is it a bug in OSProcess?

Regards
Sabine
Reply | Threaded
Open this post in threaded view
|

Re: OSProcess command - non responding image when calling often

Sabine Manaa
In reply to this post by Mariano Martinez Peck
Hi Mariano,
Great, I will try this tomorrow!
Regards
Sabine 

Am Mittwoch, 8. Juni 2016 schrieb Mariano Martinez Peck [via Smalltalk] :
Sabine,

I did not yet tested OSProcess but with OSSubprocess (in 5.0) I cannot reproduce the issue:

Polling strategy works:

Delay delaySchedulerClass: DelayMillisecondScheduler.
20 timesRepeat: [OSSUnixSubprocess new
command: 'echo';
arguments: { 
' };
redirectStdout;
runAndWaitPollingEvery: (Delay forMilliseconds: 50) retrievingStreams: true onExitDo: [
      :process :outString :errString |
      Transcript show: outString;cr .
  ].
].


Semaphore-based (child watcher) works:


Delay delaySchedulerClass: DelayMillisecondScheduler.
20 timesRepeat: [OSSUnixSubprocess new
command: 'echo';
arguments: { 'Hi There' };
redirectStdout;
runAndWaitOnExitDo: [  
      :process :outString :errString |
      Transcript show: outString;cr .
  ].
].


Using shellCommand: (bash) instead of #command: and #arguments: does work too:


Delay delaySchedulerClass: DelayMillisecondScheduler.
20 timesRepeat: [OSSUnixSubprocess new
shellCommand: ('echo "Hi there"');
redirectStdout;
runAndWaitOnExitDo: [  
      :process :outString :errString |
      Transcript show: outString;cr .
  ].
].

On Wed, Jun 8, 2016 at 3:11 PM, Sabine Manaa <[hidden email]> wrote:
Hi Mariano,

if you take the download Image from the Pharo website, then load commandShell and then zinc from the catalog browser and then do

Delay delaySchedulerClass: DelayMillisecondScheduler.
and then
20 timesRepeat: [OSProcess  command: ('echo "Hi there"').] 

Then you will get the lock.

Does this help to find the reason for the problem?

Regards
Sabine



--



If you reply to this email, your message will be added to the discussion below:
http://forum.world.st/OSProcess-command-non-responding-image-when-calling-often-tp4899540p4900000.html
To start a new topic under Pharo Smalltalk Users, email <a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;ml-node%2Bs1294792n1310670h65@n4.nabble.com&#39;);" target="_blank">ml-node+s1294792n1310670h65@...
To unsubscribe from Pharo Smalltalk Users, click here.
NAML
Reply | Threaded
Open this post in threaded view
|

Re: OSProcess command - non responding image when calling often

Sabine Manaa
Hi

@mariano: 
"Did you test if the one-liner (Delay delaySchedulerClass: DelayMillisecondScheduler.)  fixes these lookups? "

-> my config loads materialDesignLite (which loads seaside and magritte). after loading this
and trying the one liner, my image does not respond anymore.
you can reproduce it when taking a new image and loading material design lite 
(no catalog entry yet)

Gofer new
    package: 'ConfigurationOfMaterialDesignLite';
    load.

((Smalltalk at: #ConfigurationOfMaterialDesignLite) project version: #development) load. 
(proceed at the deprecated warnings for subString:)

then try the one liner. Image does not respond anymore.

 
@Paul, I took a new image, I loaded OSProcess from catalog browser and did the change.

  
| aio |
(aio := Smalltalk at: #AioEventHandler)
ifNotNil: [ aio startUp: resuming ].
OSProcessAccessor initialize.
"resuming ifTrue: [" self initializeThisOSProcess "]" (problem persists with and without code in ")

20 timesRepeat: [OSProcess  command: ('echo "Hi there"').] 

No - the problem persists.

I will stay at pharo4 for several weeks and the try again. 
If I can help fixing the problem I will do - please tell me what to do.

Regards
Sabine 
Reply | Threaded
Open this post in threaded view
|

Re: OSProcess command - non responding image when calling often

Nicolai Hess-3-2


2016-06-09 15:42 GMT+02:00 Sabine Manaa <[hidden email]>:
Hi

@mariano: 
"Did you test if the one-liner (Delay delaySchedulerClass: DelayMillisecondScheduler.)  fixes these lookups? "

-> my config loads materialDesignLite (which loads seaside and magritte). after loading this
and trying the one liner, my image does not respond anymore.
you can reproduce it when taking a new image and loading material design lite 
(no catalog entry yet)

Gofer new
    package: 'ConfigurationOfMaterialDesignLite';
    load.

((Smalltalk at: #ConfigurationOfMaterialDesignLite) project version: #development) load. 
(proceed at the deprecated warnings for subString:)

then try the one liner. Image does not respond anymore.

I think there is a running ZnServer, that does not like this change on the delay class.
Can you stop (terminate) the server and try again the change on the Delay scheduler class.

@ben, do you think the call to the scheduler class change needs another step to make sure no process (like the ZnServer) is hanging?
 

 
@Paul, I took a new image, I loaded OSProcess from catalog browser and did the change.

  
| aio |
(aio := Smalltalk at: #AioEventHandler)
ifNotNil: [ aio startUp: resuming ].
OSProcessAccessor initialize.
"resuming ifTrue: [" self initializeThisOSProcess "]" (problem persists with and without code in ")

20 timesRepeat: [OSProcess  command: ('echo "Hi there"').] 

No - the problem persists.

I will stay at pharo4 for several weeks and the try again. 
If I can help fixing the problem I will do - please tell me what to do.

Regards
Sabine 

Reply | Threaded
Open this post in threaded view
|

Re: OSProcess command - non responding image when calling often

Sabine Manaa
Hi Nicolai,

Thanks! I stopped all ZnServers with 
WAServerManager default stopAll. 

Then I can do
Delay delaySchedulerClass: DelayMillisecondScheduler.
without problems.

20 timesRepeat: [OSProcess  command: ('echo "Hi there"').] .
here, the problem persists -> locking image
your code with OSSubprocess is working fine.

@Mariano: it seems to be another problem with the locks in OSProcess because after changing the delaySchedulerClass, I get locking images with the OSProcess command: ....

Regards
Sabine




 

2016-06-09 19:13 GMT+02:00 Nicolai Hess-3-2 [via Smalltalk] <[hidden email]>:


2016-06-09 15:42 GMT+02:00 Sabine Manaa <[hidden email]>:
Hi

@mariano: 
"Did you test if the one-liner (Delay delaySchedulerClass: DelayMillisecondScheduler.)  fixes these lookups? "

-> my config loads materialDesignLite (which loads seaside and magritte). after loading this
and trying the one liner, my image does not respond anymore.
you can reproduce it when taking a new image and loading material design lite 
(no catalog entry yet)

Gofer new
    package: 'ConfigurationOfMaterialDesignLite';
    load.

((Smalltalk at: #ConfigurationOfMaterialDesignLite) project version: #development) load. 
(proceed at the deprecated warnings for subString:)

then try the one liner. Image does not respond anymore.

I think there is a running ZnServer, that does not like this change on the delay class.
Can you stop (terminate) the server and try again the change on the Delay scheduler class.

@ben, do you think the call to the scheduler class change needs another step to make sure no process (like the ZnServer) is hanging?
 

 
@Paul, I took a new image, I loaded OSProcess from catalog browser and did the change.

  
| aio |
(aio := Smalltalk at: #AioEventHandler)
ifNotNil: [ aio startUp: resuming ].
OSProcessAccessor initialize.
"resuming ifTrue: [" self initializeThisOSProcess "]" (problem persists with and without code in ")

20 timesRepeat: [OSProcess  command: ('echo "Hi there"').] 

No - the problem persists.

I will stay at pharo4 for several weeks and the try again. 
If I can help fixing the problem I will do - please tell me what to do.

Regards
Sabine 




If you reply to this email, your message will be added to the discussion below:
http://forum.world.st/OSProcess-command-non-responding-image-when-calling-often-tp4899540p4900191.html
To start a new topic under Pharo Smalltalk Users, email [hidden email]
To unsubscribe from Pharo Smalltalk Users, click here.
NAML

Reply | Threaded
Open this post in threaded view
|

Re: OSProcess command - non responding image when calling often

Sabine Manaa
and it seems that on windows the problem does not exist.
So I could use OSSubprocess on unix and OSProcess on windows.

2016-06-10 9:25 GMT+02:00 Sabine Manaa <[hidden email]>:
Hi Nicolai,

Thanks! I stopped all ZnServers with 
WAServerManager default stopAll. 

Then I can do
Delay delaySchedulerClass: DelayMillisecondScheduler.
without problems.

20 timesRepeat: [OSProcess  command: ('echo "Hi there"').] .
here, the problem persists -> locking image
your code with OSSubprocess is working fine.

@Mariano: it seems to be another problem with the locks in OSProcess because after changing the delaySchedulerClass, I get locking images with the OSProcess command: ....

Regards
Sabine




 

2016-06-09 19:13 GMT+02:00 Nicolai Hess-3-2 [via Smalltalk] <[hidden email]>:


2016-06-09 15:42 GMT+02:00 Sabine Manaa <[hidden email]>:
Hi

@mariano: 
"Did you test if the one-liner (Delay delaySchedulerClass: DelayMillisecondScheduler.)  fixes these lookups? "

-> my config loads materialDesignLite (which loads seaside and magritte). after loading this
and trying the one liner, my image does not respond anymore.
you can reproduce it when taking a new image and loading material design lite 
(no catalog entry yet)

Gofer new
    package: 'ConfigurationOfMaterialDesignLite';
    load.

((Smalltalk at: #ConfigurationOfMaterialDesignLite) project version: #development) load. 
(proceed at the deprecated warnings for subString:)

then try the one liner. Image does not respond anymore.

I think there is a running ZnServer, that does not like this change on the delay class.
Can you stop (terminate) the server and try again the change on the Delay scheduler class.

@ben, do you think the call to the scheduler class change needs another step to make sure no process (like the ZnServer) is hanging?
 

 
@Paul, I took a new image, I loaded OSProcess from catalog browser and did the change.

  
| aio |
(aio := Smalltalk at: #AioEventHandler)
ifNotNil: [ aio startUp: resuming ].
OSProcessAccessor initialize.
"resuming ifTrue: [" self initializeThisOSProcess "]" (problem persists with and without code in ")

20 timesRepeat: [OSProcess  command: ('echo "Hi there"').] 

No - the problem persists.

I will stay at pharo4 for several weeks and the try again. 
If I can help fixing the problem I will do - please tell me what to do.

Regards
Sabine 




If you reply to this email, your message will be added to the discussion below:
http://forum.world.st/OSProcess-command-non-responding-image-when-calling-often-tp4899540p4900191.html
To start a new topic under Pharo Smalltalk Users, email [hidden email]
To unsubscribe from Pharo Smalltalk Users, click here.
NAML


Reply | Threaded
Open this post in threaded view
|

Re: OSProcess command - non responding image when calling often

Gastón Dall' Oglio
In reply to this post by Paul DeBruicker
Hi Paul, thanks for remark my post! :)

The important here is that David Lewis has confirmed it fix the problem,

But I don't know if you guys have here the same problem I had, because the issue was in Windows (). Just test change ThisOSProcess>>startUp: and see what happens :)

ThisOSProcess>>startUp: resuming
| aio |
(aio := Smalltalk at: #AioEventHandler)
ifNotNil: [ aio startUp: resuming ].
 *OSProcessAccessor initialize.*
self initializeThisOSProcess

HTH
Regards.



2016-06-08 15:12 GMT-03:00 Paul DeBruicker <[hidden email]>:
Hi Sabine,

I had a Pharo 5 image where running

OSProcess waitForCommand:'ls'

twice would lock everything up.

Following Gaston's suggestion here:

http://forum.world.st/Problem-with-delay-waiting-OSSubprocess-code-on-Pharo-5-0-td4895780.html#a4898158

Fixed it for me.  Maybe we hit the same issue.


Paul


Sabine Manaa wrote
> Hi,
>
> sorry but I have another issue with OSProcess.
>
> For my app, I want to show small .png previews from my .pdfs. For this
> reason, I use an external software, currently pdfbox. It works fine, but
> regularly, I get a hanging image. I tried to reproduce it and found out,
> that it is not a problem with pdfbox (http://pdfbox.apache.org), because
> from command line, I can call it often without problems. There can be
> (hopefully) many users in my app with many previews at one time. So I have
> to call it often.
>
> For reproduction of the OSProcess issue, I used another simple command
> (from my other OSProcess umlaut issue :-)) to test it.
>
> calling this, results in a non responding image:
>
> 20 timesRepeat: [OSProcess   command: ('cp
> /Library/WebServer/Documents/reports/bar.pdf
> /Library/WebServer/Documents/reports/test-c.pdf').].
>
> also this:
> 20 timesRepeat: [OSProcess   command: ('echo "Hi there"').]
>
> My original code is similar to this but here only for information:
> OSProcess
>               command:
>                       ('{1} -jar {2} PDFToImage -format PNG -page 1 -dpi 100 {3}'
>                               format:
>                                       {'Library/Internet\
> Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java'.
>                                       '/Users/sabine/Desktop/pdfbox-app-2.0.1.jar'.
>
> '/Library/WebServer/Documents/reports/201411121510-112859865-3378921/20150605_170_IFA_Berlin_Reisekostenabrechnung.pdf'}).
>
>
> So, my question is: is it wrong, calling OSProcess like this? How to do it
> instead?
>
> I am sorry to ask again and hope that there is a simple solution.
> Or is it a bug in OSProcess?
>
> Regards
> Sabine





--
View this message in context: http://forum.world.st/OSProcess-command-non-responding-image-when-calling-often-tp4899540p4900002.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.


12