On Wed, Jul 31, 2013 at 6:59 AM, Amos Jeffries <squid3_at_treenet.co.nz> wrote:
> On 31/07/2013 9:18 a.m., Klaus Walter wrote:
>> strace shows me that this helpers are blocked during a read-command:
>> ....
>> read(0, "r", 1) = 1
>> read(0, "r", 1) = 1
>> read(0, "7", 1) = 1
>> read(0, "+", 1) = 1
>> read(0, "a", 1) = 1
>> read(0, "G", 1) = 1
>> read(0, <unfinished ...>
>>
>> After this the process is never continued.
>
>
> That does not look blocked to me. The value arriving is changing, just
> vvvveeerrrryyyy ssslloowwwlllyyy, one byte per I/O cycle to be exact. Since
> kerberos credentials can be up to 32 KB large its easy to see why they are
> stuck in BUSY state for such long times.
I see the helper is reading one byte at a time.
The code for the kerberos explicitly disables buffering:
setbuf(stdout, NULL);
setbuf(stdin, NULL);
As a test, I removed setbuf(stdin, NULL), and it works well: the
helper no longer reads one byte at a time, but the whole thing at
once.
I tried to take it further and enable buffering for stdout as well,
but it doesn't work: the helpers don't write anything until the buffer
is full, so it just hangs. I think glibc only flushes stdout on
newline when stdout is a terminal. So I added explicit calls to
fflush() after each fprintf(stdout, ...), and now it works like a
charm.
I haven't measured the performance improvement with this, and I'm sure
it doesn't solve Klaus' issue, but I am very interested in improving
performance in every possible way, even if its a small improvement.
If anybody is interested, please see the attached patch against Squid 3.3.8.
Best regards,
Alan
---- I'm resending this message because it was rejected due to the attachment. If you are interested in the patch, please run: echo H4sICJB6+FEAA25lZ290aWF0ZV9rZXJiZXJvc19hdXRoLWJ1ZmZlcmluZy5wYXRjaADtmG1z0zgQgD9ff8XSm7Z246R2nHcuMw3XAJ22KZT05m6g43Ft2TEksrHkQo/jv99KdlLHcQqlMBzDaTqNR7Z2tY92Vyu5gedBNYFqDOxtErhVs2bWOrUwDvy9CZlGJGZ7lPghD2xOLDvhk703JL4kcZjvn3fJD2qOk5d1DzEb1Wr1a07rl7pumFW9XTUNMIxew+wZ3VrXrNe7zY5pQkXv6vpGpVL5StMvqmv1TL1mtHRdb7Zb3Uz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3PUiaicf26PRj1OdC1JaJBnmGatQl+afBd4ZYpttFoleEXbjSAtDm+fwgqJwWNxmMq7lwZigndKh+uW7mD46PxJD5Z0lO2Amd7Yc4y22bEIc+yISE5qUVX5qa1g2tqTG07j1oObRN3WJep254dOGqPBD5A0Oi2Jutv8P2msI3ufpNFtCLxNvfEtk8bmYNDvb36HrDFX/N9IG82GrnUQttwHBWyUugEzO6CicIX01iS1Nb3mETcoLy9wRh++7KZGzl4KFLcDJ4M/rcH5+On49Gg4so6Ho4uHSzc5xlL4CByeTzhLT0lpPZwefKpgYIfQpOYjLzVRbkLNZllmJO8DruhqeTVcFktH2R1lHq1MfRhjLImiME5Jf/IyD/Xg36+EumjW3i48HfwxtDArD54dwu7exr8zzzqnWBYAAA== | perl -MCompress::Zlib -MMIME::Base64 -e 'print Compress::Zlib::memGunzip(decode_base64(<>))' > /tmp/negotiate_kerberos_auth-buffering.patchReceived on Wed Jul 31 2013 - 03:16:26 MDT
This archive was generated by hypermail 2.2.0 : Wed Jul 31 2013 - 12:00:05 MDT