At first, I thought it was an already known limitation in mochiweb
(the stack is couchdb/mochiweb/erlang).
But with large amounts of ioformat debugging, I've pinned it down to a
call from mochiweb to gen_tcp:recv which fails on this long URL.
Is this a known limitation in erlang's gen_tcp:recv?
Rachel
________________________________________________________________
erlang-questions (at) erlang.org mailing list.
See http://www.erlang.org/faq.html
To unsubscribe; mailto:erlang-questio...@erlang.org
inet:setopts(Socket, [{packet, http}]),
case gen_tcp:recv(Socket, 0, ?IDLE_TIMEOUT) of
{ok, {http_request, Method, Path, Version}} ->
headers(Socket, {Method, Path, Version}, [], Body, 0)
end.
Rachel - how about providing a reproducible test case and making it an
issue in the mochiweb project? There might be some continuation
response from recv that mochiweb doesn't currently expect to receive.
http://code.google.com/p/mochiweb/issues/entry
From what I could see from the response from gen_tcp:recv, it's just
returning an error, not a continuation response, so I don't think
there's anything for mochiweb to handle.
But yes, I will add the test case and the diagnostic tomorrow. Just
wanted to check now that this wasn't already a known issue/limitation.
I'm sure someone knows about it, but it's definitely not something
everyone knows.
Is there a use case for such a long URL? Most browsers and servers
have some kind of limit (2038 for IE, 8190 for apache 2.2 by default,
16k for IIS, ...). 8k might be a little conservative, but how far do
you really want to go?
inet:setopts(Socket, [{recbuf,16384}]).
By passing a 0 for the length to recv, you're telling it to receive
all available bytes. I assume it can't receive more bytes than its
buffer can store.
--steve
If you do not know exactly what recbuf does you may instead use the option
{buffer, Size} which only affects the inet driver read buffer
/Tony
Trying it now...
Rachel
The use case for the long URL is couchdb replication, by the way.
https://issues.apache.org/jira/browse/COUCHDB-644
It's a good enough solution for what I need right now, (which is to be
able to replicate some very large couchdb databases without the system
falling over).
But I'd agree that it's probably not the "best" solution, and I
wouldn't suggest changing the default buffer size.
I'm going to do some further digging around inside the couchdb code to
figure out why these long URLs are being generated in the first place.
There is supposed to be code in there which splits the request into
multiple requests if the revision list is too long, but that doesn't
seem to be working. Fixing that would be a better solution.