[Gambas-user] Problems with the IDE and Stream buffering

Tobias Boege taboege at ...626...
Thu Aug 29 21:34:44 CEST 2013


On Thu, 29 Aug 2013, Beno?t Minisini wrote:
> Le 26/08/2013 15:30, Tobias Boege a ?crit :
> > On Wed, 21 Aug 2013, Tobias Boege wrote:
> >> Hi folks,
> >>
> >> is anyone else having trouble with the latest revision(s)? I observed two
> >> things:
> >>
> >> 1) Stream buffering broken. If I have a Process (it may equivalently well
> >>     be only a Process problem (not a general Stream one) as it is the Process
> >>     code which was touched recently), I get one line from it and nothing more
> >>     until the program terminates (or the Process object is released).
> >>
> >>     The IDE has the same problem with my programs: If I use Print/Debug/Error
> >>     in the code, the IDE doesn't see them until the program is closed.
> >>
> >> 2) IDE property panel unusable. I can't set values anymore. The errors say
> >>     "Incorrect property value." for everything. I can't set a Boolean to True
> >>     anymore, to give an example.
> >>
> >> I did a complete
> >>
> >> $ make clean && ./reconf-all && ./configure && make -j5 && sudo make install
> >>
> >> and the problems remain!
> >>
> >> I'd like to know if anyone can reproduce these problems or if something over
> >> here is _seriously_ broken.
> >>
> >> Oh, and I should note that I have also installed an alternate version of
> >> Gambas in my local $HOME/bin which I can run and it doesn't show the above
> >> both symptoms. My broken version in use is #5812 and the working alternate
> >> version is #5801.
> >>
> >
> > FYI, I downgraded to #5802 and the problems are gone. So I guess I'll have
> > to wait for Benoit as it's likely not my system which gets things wrong but
> > Gambas.
> >
> > Regards,
> > Tobi
> >
> 
> Is it better with revision #5816?
> 

It's not. I spent the afternoon searching for a solution myself. I should
note that I use Line Input in a Read event of a file or a process (in my
test project). The symptom is that the Read event does not raise anymore.

Before #5816, both didn't work. With #5816, the process is OK, but not the
file.

If I am correct, with the recent changes, a stream's read function can (if
it returns non-zero in case of EOF) disable generation of Read events. This
happens e.g. when the file is completely read into the buffer. Even if the
buffer has data left inside, the fd is completely read and the read
callbacks are disabled.

I have a patch attached which fixes Process and File on my system when used
with Line Input in a Read event but I don't know if the changes are placed
properly. It should apply to #5816.

Regards,
Tobi

PS: I have also to report that my program slows down insanely when they read
    many data from a process (like when I watch a Gambas compilation). But
    feel free to return to this issue after your holidays.
-------------- next part --------------
Index: main/gbx/gbx_stream.c
===================================================================
--- main/gbx/gbx_stream.c	(revision 5816)
+++ main/gbx/gbx_stream.c	(working copy)
@@ -563,8 +563,6 @@
 		if (errno == EINTR)
 			continue;
 
-		stop_watching(stream, GB_WATCH_READ);
-
 		switch(errno)
 		{
 			case 0:
@@ -657,6 +655,7 @@
 			
 			if (!buffer_len)
 			{
+				stop_watching(stream, GB_WATCH_READ);
 				stream->common.eof = TRUE;
 				break;
 			}


More information about the User mailing list