Bug 5326 - Print jobs fail above certain size (73-126kB)
Summary: Print jobs fail above certain size (73-126kB)
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: Printing (show other bugs)
Version: 3.6.1
Hardware: x86 Linux
: P3 normal
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL: https://bugs.launchpad.net/ubuntu/+so...
Keywords:
Depends on:
Blocks: 8595
  Show dependency treegraph
 
Reported: 2008-03-15 05:00 UTC by TEN
Modified: 2011-11-16 19:34 UTC (History)
4 users (show)

See Also:


Attachments
Patch for 3.0.x. (882 bytes, patch)
2008-03-27 19:49 UTC, Jeremy Allison
kukks: review+
Details
Patches for v3-6-test (3.11 KB, patch)
2011-11-11 01:13 UTC, Stefan Metzmacher
kukks: review+
Details
Patches for v3-5-test (3.11 KB, patch)
2011-11-11 01:17 UTC, Stefan Metzmacher
kukks: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description TEN 2008-03-15 05:00:33 UTC
As reproduced by several users in attempts to resolve the final Samba-specific part of https://bugs.launchpad.net/ubuntu/+source/foomatic-filters/+bug/60931 on irc://irc.freenode.net/#samba-os2, when printing through smbclient to printers at least on machines running OS/2 Warp 4 or eCS will cause the print jobs to fail above a certain size, as only the first e.g. 126kB (apparently machine-dependent) of each job will end up in the destination queue, even though smbclient reports the following:

smb: \> print job.ps
Error writing file: SUCCESS - 0
putting file job.ps as job.ps (384.1 kb/s) (average 617.6 kb/s)

On OS/2 this can be traced by setting the respective printer to Hold and copy the job files out of D:\Spool\MyPSprtr\*.SPL, to diff -u them against the ones sent via smbclient.

Discussion on irc://irc.freenode.net/#samba-technical indicates comparative wireshark sniffs may be needed to help resolve this issue.
Comment 1 Guenter Kukkukk 2008-03-15 18:46:20 UTC
The following is happening here:

smbclient uses the _same_ internal function cli_write() for the cmds
"put" and "print". "put" is working, "print" is failing !

The difference is, that "put" is used against a file share and "print"
against a print share.
On the receiving os/2 side both requests are handled by different services.
The printing stuff is handled by the spooler - and this one handles the
WriteAndX Response different than the peer or server service.
Maybe even the "smb protocol specs" have some info about this...

Beside others WriteAndX Response has 2 fields (from the wireshark display):
  Count Low
  Count High (multiply with 64K)

which match the code in cli_write() as:
  bwritten += SVAL(cli->inbuf, smb_vwv2);
  bwritten += (((int)(SVAL(cli->inbuf, smb_vwv4)))<<16);

"bwritten" is summing up the total number of bytes written so far.

The difference between "put" and "print", as responded back from os/2:
When "print" is used, os/2 uses
  "Count Low" as usual (bytes received), but
  "Count High (multiply with 64K)" is containing "the current 64k page"
or some similar named stuff. Hard to explain
Here my debug output:
GK: 4096 0
GK: 4096 0
GK: 4096 0
GK: 4096 0
GK: 4096 0
GK: 4096 0
GK: 4096 0
GK: 4096 0
GK: 4096 0
GK: 4096 0
GK: 4096 0
GK: 4096 0
GK: 4096 0
GK: 4096 0
GK: 4096 0
GK: 4096 1
GK: 4096 1
GK: 4096 1
GK: 4096 1
GK: 4096 1
GK: 4096 1
GK: 4096 1
GK: 4096 1
GK: 4096 1
GK: 4096 1
GK: 4096 1
GK: 4096 1
GK: 4096 1
GK: 4096 1
GK: 4096 1
GK: 4096 1
GK: 4096 2
GK: 4096 2
GK: 4096 2
GK: 4096 2
GK: 4096 2
GK: 4096 2
GK: 4096 2
GK: 4096 2
GK: 4096 2
GK: 4096 2
GK: 4096 2
GK: 4096 2
GK: 4096 2
GK: 4096 2
GK: 4096 2
GK: 4096 2
GK: 4096 3
GK: 4096 3
GK: 4096 3
...
Chunks of 4096 bytes are passed over here.
So the current summing up 
  bwritten += SVAL(cli->inbuf, smb_vwv2);
  bwritten += (((int)(SVAL(cli->inbuf, smb_vwv4)))<<16);
cannot work!  :-)

bwritten += (((int)(SVAL(cli->inbuf, smb_vwv4)))<<16); must be _ignored_ here.

I temporarely commented out this line - and from now on i was able to
print ebay.com.ps (TEN emailed it) and Opera also prints fine now to
our os/2 warpserver 5.0 connected postscript printer!  :-)

BTW - during "put" file transfers the field "Count High" was always returned
as zero.

Cheers, Guenter
Comment 2 Guenter Kukkukk 2008-03-16 20:32:49 UTC
I had planned to also test this against a recent windows system,
but time went out after some first checks - had to do preparations
for a 8 days holidays trip...

With the unmodified original v3-2-test version I got:
Error writing file: NT_STATUS_OK
(0,0 kb/s) (average 0,0 kb/s)

But this needs more testing ...
Cheers, Günter
Comment 3 Jeremy Allison 2008-03-27 19:49:05 UTC
Created attachment 3220 [details]
Patch for 3.0.x.

Guenter, can you try this patch for 3.0.x ? Hopefully should fix the bug.
Thanks,
Jeremy.
Comment 4 Guenter Kukkukk 2008-03-28 00:12:48 UTC
Jeremy,

great - your patch fixed that os/2 printing problem. :-)

Interesting enough, i never hit that one before - was only
printing small ascii pages in the past (which worked).

TEN told me on irc, that this one "is a very long outstanding one" - and
the fix will make "many os/2 users very happy". :-)

In v3-2-test some variables renaming has been done - but your
patch should match, too.

Cheers, Günter
Comment 5 Jeremy Allison 2008-03-28 16:07:55 UTC
Fixed in 3.0.x and 3.2 git trees
Jeremy.
Comment 6 Stefan Metzmacher 2011-11-08 08:31:59 UTC
3.6 has this problem again.
Comment 7 Guenter Kukkukk 2011-11-09 04:28:16 UTC
Hi Stefan,

your changes in
http://git.samba.org/?p=samba.git;a=commitdiff;h=95595dd93fd04999fcf56ecaab7c29b064d021f8

look fine to me and fixes the problem!

How do i add "Signed-off-by:" ?

This bug can be closed.

Cheers, Günter
Comment 8 Stefan Metzmacher 2011-11-11 01:13:27 UTC
Created attachment 7084 [details]
Patches for v3-6-test

This is the backport for 3.6.2 that needs review
Comment 9 Stefan Metzmacher 2011-11-11 01:14:10 UTC
This can be closed when the patches are in the release branches
Comment 10 Stefan Metzmacher 2011-11-11 01:17:01 UTC
Created attachment 7085 [details]
Patches for v3-5-test
Comment 11 Stefan Metzmacher 2011-11-15 21:53:16 UTC
Günter, can you also give a review + for the 3.6 patch
and assign this to Karolin
Comment 12 Guenter Kukkukk 2011-11-16 01:13:43 UTC
Hi Karolin,

these patches look fine to me.
Cheers, Günter
Comment 13 Karolin Seeger 2011-11-16 19:34:28 UTC
Pushed to v3-5-test and v3-6-test.
Closing out bug report.

Thanks!