[X2go-dev] [X2go-user] 10x printing speed increase for x2go printing

--[ UxBoD ]-- uxbod at splatnix.net
Tue Apr 12 17:37:48 CEST 2011


----- Original Message -----
> ----- Original Message -----
> > ----- Original Message -----
> > > Hi Phil,
> > > 
> > > On Mo 11 Apr 2011 13:25:55 CEST "--[ UxBoD ]--" wrote:
> > > 
> > > > ----- Original Message -----
> > > >> Hi Phil,
> > > >>
> > > >> On Mo 11 Apr 2011 12:07:57 CEST "--[ UxBoD ]--" wrote:
> > > >>
> > > >> > Yep that is my interpretation of the process as-well, Mike.
> > > >> > One
> > > >> > thing I have noticed is that if you print the resultant PDF
> > > >> > the
> > > >> > file
> > > >> > is left in the spool directory without being deleted; yet if
> > > >> > you
> > > >> > cancel from the x2go-print dialogue box the file is removed.
> > > >>
> > > >> is that x2goclient or PyHoca-GUI/Python X2go? With PyHoca-GUI
> > > >> this
> > > >> should not happen, otherwise it is a bug I have missed so
> > > >> far...
> > > >>
> > > >> Greets,
> > > >> Mike
> > > >>
> > > >>
> > > >>
> > > >
> > > > x2goclient 3.01.18.
> > > 
> > > we have an unofficial bugtracker that we (the devs and the
> > > community)
> > > still have to discuss about. However, maybe you place such stuff
> > > in
> > > there already. In case of dropping the software again (Horde) we
> > > will
> > > surely migrate the already placed-in tickets.
> > > 
> > > The chance of forgetting such tiny issues without accounting is
> > > otherwise potentially given...
> > > 
> > > Greets,
> > > Mike
> > > 
> > 
> > Mike,
> > 
> > I think I may have worked out why some print jobs are failing and
> > it
> > would appear to be an x2go issue and not SSHFS/WAN.
> > 
> > What is happening is that the Perl script, x2goprint, moves the PDF
> > from /var/spool/x2goprint into the users mounted spool directory
> > and
> > then creates the .ready file. The x2goclient looks for any new
> > files
> > in that directory and if it sees the .ready file it pops up the
> > x2go
> > print dialogue window. Now, looking at the code it appears to
> > remove
> > the file as-well; in 3.01-18 the pertinent code is in
> > onmainwindow_part4.cpp line 200.
> > 
> > I am thinking this is a timing issue with respect to the .ready
> > file
> > being written and the slot which monitors the local spool directory
> > firing off an event.
> > 
> > Just not sure how to solve it yet :(
> 
> Okay, in onmainwindow_part4 here is the bit of code which I believe
> is causing the issue:
> 
> 
> if ( !file.open ( QIODevice::ReadOnly | QIODevice::Text ) )
>             continue;
>         bool startProc=false;
>         QString fname,title;
>         if ( !file.atEnd() )
> 
> My theory is that a lock still exists on the .ready file for which
> the file.open() cannot be called and therefore the code continues
> and ultimately removes the .ready file; taking into account the loop
> I put into x2goprint the script sees that the file has disappeared
> and writes it again. This is why I believe we see a different count
> number each time.
> 
> Any thoughts on how to resolve this one ?

Reading the Qt document I see:

"Returns true if the current read and write position is at the end of the device (i.e. there is no more data available for reading on the device); otherwise returns false.
For some devices, atEnd() can return true even though there is more data to read. This special case only applies to devices that generate data in direct response to you calling read() (e.g., /dev or /proc files on Unix and Mac OS X, or console input / stdin on all platforms)."

I am guessing that when the perl script opens the file for writing the x2go client is so quick and sees that it is at the end straight away; drops past the if loop and then removes the .ready file.


        if ( !file.atEnd() )
        {
            QByteArray line = file.readLine();
            QString fn ( line );
            fn.replace ( "\n","" );
            fname=fn;
            if ( !file.atEnd() )
            {
                line = file.readLine();
                title=line;
                title.replace ( "\n","" );
            }
            startProc=true;
        }

Perhaps one approach would be to keep looping through the .ready file until it reads an EOF marker ? Then the writing process has truly completed.
-- 
Thanks, Phil



More information about the x2go-dev mailing list