Paolo Bonzini | 1 Feb 08:26
Picon
Gravatar

Re: [bug] Delay issue

On 01/31/2012 09:32 PM, Gwenaël Casaccio wrote:
>
> Eval [
>      | d1 d2 p1 p2 |
>      sem := Semaphore new.
>      d1 := Delay forSeconds: 1.
>      p1 := [ d1 value: [ sem signal ] onTimeoutDo: [ ] ] fork.
>      sem wait.
>
>      'value:onTimeoutDo:' displayNl.
>      d1 := Delay forMilliseconds: 100.
>      d1 value: [ [ true ] whileTrue ] onTimeoutDo: [ ].
> ]

Let's fix this too, then. :)

Paolo
Gwenaël Casaccio | 2 Feb 09:46
Picon
Gravatar

Re: [bug] Delay issue

On 01/02/2012 08:26, Paolo Bonzini wrote:
> On 01/31/2012 09:32 PM, Gwenaël Casaccio wrote:
>>
>> Eval [
>>      | d1 d2 p1 p2 |
>>      sem := Semaphore new.
>>      d1 := Delay forSeconds: 1.
>>      p1 := [ d1 value: [ sem signal ] onTimeoutDo: [ ] ] fork.
>>      sem wait.
>>
>>      'value:onTimeoutDo:' displayNl.
>>      d1 := Delay forMilliseconds: 100.
>>      d1 value: [ [ true ] whileTrue ] onTimeoutDo: [ ].
>> ]
>
> Let's fix this too, then. :)
>
> Paolo
Hi Paolo,  the bug comes when the process is removed from the middle of 
the list.

So here is the patch

diff --git a/libgst/interp.c b/libgst/interp.c
index fe154be..515f84a 100644
--- a/libgst/interp.c
+++ b/libgst/interp.c
@@ -305,6 +305,9 @@ static OOP highest_priority_process (void);
     LinkedList) and answer it.  */
  static OOP remove_first_link (OOP semaphoreOOP);
(Continue reading)

Derek Zhou | 2 Feb 13:02
Picon

non-blocking pipe read issue

Hi all,
I think there is a bug in the async reading of a pipe. Here is a example:
mkfifo a2b
mkfifo b2a
a.st:

f1 := File name: 'a2b'.
f2 := File name: 'b2a'.
aWriter := f1 writeStream.
bReader := f2 readStream.
counter := 0.
[
    aWriter nextPutAll: 'hello'; nl.
    aWriter flush.
    bReader nextLine.
    counter := counter + 1.
    (counter \\ 10000) = 0 ifTrue: [
    Transcript nextPutAll: '%1 times' % {counter}; nl ] ] repeat.

b.st:

f1 := File name: 'a2b'.
f2 := File name: 'b2a'.
aReader := f1 readStream.
bWriter := f2 writeStream.
counter := 0.
[
    aReader nextLine.
    bWriter nextPutAll: 'hello'; nl.
    bWriter flush.
(Continue reading)

Paolo Bonzini | 2 Feb 13:26
Picon
Gravatar

Re: non-blocking pipe read issue

On 02/02/2012 01:02 PM, Derek Zhou wrote:
> Although it does a second poll after the sig handler setup trying to catch
> this possibility, the data could still come in after the second poll but
> before the _gst_sync_wait. The sig handler will trigger but it does not
> prevent the process going to sleep.
>
>  From the look of it the problem is not limited to pipes, the same could
> happen to sockets as well.
>
> Possible fixes:
> * block SIGIO until the process is really asleep in an atomic operation.
> However I don't know how.

It must be more subtle than that.

The SIGIO will not be processed immediately; it will be processed before 
executing the next bytecode.  This should close the race window with the 
update of the list.  In fact, the second poll could be removed, I think.

Paolo
Paolo Bonzini | 2 Feb 13:39
Picon
Gravatar

Re: non-blocking pipe read issue

On 02/02/2012 01:02 PM, Derek Zhou wrote:
> RETSIGTYPE
> file_polling_handler (int sig)
> {
>    if (num_used_pollfds>  0)
>      {
>        _gst_disable_interrupts (true);
>        _gst_async_call (async_signal_polled_files, NULL);
>        _gst_enable_interrupts (true);
>      }
>
>    _gst_set_signal_handler (sig, file_polling_handler);
>    _gst_wakeup ();
> }
>
> ...
>    set_file_interrupt (fd, file_polling_handler);
>
>    /* Now check if I/O was made possible while setting up our machinery...
>       If so, exit; otherwise, wait on the semaphore and the SIGIO
>       will wake us up.  */
>
>    result = _gst_sync_file_polling (fd, cond);
>    if (result == 0)
>      {
>        if (!head)
>          head = new;
>        else
>          *p_tail_next = new;
>        p_tail_next =&new->next;
(Continue reading)

Paolo Bonzini | 2 Feb 13:50
Picon
Gravatar

Re: [bug] Delay issue

On 02/02/2012 09:46 AM, Gwenaël Casaccio wrote:
>>
> Hi Paolo,  the bug comes when the process is removed from the middle of
> the list.

Thanks Gwen!

There is already remove_process_from_list, I am committing a similar 
patch that uses it.

Paolo
Derek Zhou | 3 Feb 02:59
Picon

Re: non-blocking pipe read issue

On Thu, Feb 02, 2012 at 01:39:41PM +0100, Paolo Bonzini wrote:
> On 02/02/2012 01:02 PM, Derek Zhou wrote:
> >RETSIGTYPE
> >file_polling_handler (int sig)
> >{
> >   if (num_used_pollfds>  0)
> >     {
> >       _gst_disable_interrupts (true);
> >       _gst_async_call (async_signal_polled_files, NULL);
> >       _gst_enable_interrupts (true);
> >     }
> >
> >   _gst_set_signal_handler (sig, file_polling_handler);
> >   _gst_wakeup ();
> >}
> >
> >...
> >   set_file_interrupt (fd, file_polling_handler);
> >
> >   /* Now check if I/O was made possible while setting up our machinery...
> >      If so, exit; otherwise, wait on the semaphore and the SIGIO
> >      will wake us up.  */
> >
> >   result = _gst_sync_file_polling (fd, cond);
> >   if (result == 0)
> >     {
> >       if (!head)
> >         head = new;
> >       else
> >         *p_tail_next = new;
(Continue reading)

Picon

[PATCH] Make gst-package --test new_package.xml work

Hi Paolo,

$ gst-package --test package.xml

fails if the package is just being installed. This is because 
PackageDirectories>>#refreshStarList: is never called. My patch is to flush 
the PackageLoader state, and then refresh, I am not sure if I break something 
in regard to svn/git/http packages.

holger
_______________________________________________
help-smalltalk mailing list
help-smalltalk <at> gnu.org
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Paolo Bonzini | 3 Feb 10:29
Picon
Gravatar

Re: [PATCH] Make gst-package --test new_package.xml work

On 02/03/2012 10:26 AM, Holger Hans Peter Freyther wrote:
>
>
> $ gst-package --test package.xml
>
> fails if the package is just being installed. This is because
> PackageDirectories>>#refreshStarList: is never called. My patch is to
> flush the PackageLoader state, and then refresh, I am not sure if I
> break something in regard to svn/git/http packages.

I think this is fine.

Paolo
Ladislav Marek | 3 Feb 19:49
Picon

Re: typo in MessageLookup

I'm getting an error when building GST:

gst-doc: Invalid argument nil: must be a Symbol

backtrace:

optimized [] in UndefinedObject>>executeStatements (../scripts/GenDoc.st:176)
SystemExceptions.WrongClass(Exception)>>activateHandler: (ExcHandling.st:515)
SystemExceptions.WrongClass(Exception)>>signal (ExcHandling.st:254)
SystemExceptions.WrongClass class>>signalOn:mustBe: (SysExcept.st:778)
SystemExceptions.WrongClass class>>signalOn:mustBe: (SysExcept.st:774)
Object class(Object)>>perform:withArguments: (Object.st:1269)
MessageLookup>>sendTo: (MessageLookup.st:78)
Object class(Object)>>perform: (Object.st:1138)
STInST.STClassLoaderObjects.ProxyClass>>doesNotUnderstand: #name
(Parser.star#VFS.ZipFile/STLoaderObjs.st:815)
STInST.STClassLoaderObjects.ProxyClass(STInST.STClassLoaderObjects.PseudoBehavior)>>nameIn:
(Parser.star#VFS.ZipFile/STLoaderObjs.st:606)
STInST.TexinfoDocPublisher class>>printTreeClass:shouldLink:on:indent:
(ClassPublisher.star#VFS.ZipFile/Texinfo.st:227)
[] in STInST.TexinfoDocPublisher class(STInST.DocPublisher
class)>>printHierarchyOf:hierarchy:startAt:on:indent:
(ClassPublisher.star#VFS.ZipFile/Publish.st:561)
SortedCollection(OrderedCollection)>>do: (OrderColl.st:66)
SortedCollection>>do: (SortCollect.st:121)
STInST.TexinfoDocPublisher class(STInST.DocPublisher
class)>>printHierarchyOf:hierarchy:startAt:on:indent:
(ClassPublisher.star#VFS.ZipFile/Publish.st:555)
STInST.TexinfoDocPublisher class(STInST.DocPublisher
class)>>makeDescendentsDictionary:thenPrintOn:
(Continue reading)


Gmane