Sorry, this was intended for the list:
Edi Weitz wrote:
How did you run the automated tests? What kind of files did you upload? Are you using the latest versions of Chunga, FLEXI-STREAMS, and mod_lisp2?
Yes, I'm running the latest versions. (My mod_lisp2 was a couple of months old, but now I had upgraded it). For testing I'm using a small python script that repeatedly uploads the same file, it's available at http://85.65.214.241/misc/test-upload.tar.gz Actually with hunchentoot 0.5.1 and the latest mod_lisp2 (not sure which one is responsible) I see a slightly different behavior: there's no message about file being closed in the log, but after several attempts the request seems to hang and after some time apache logs [error] (70007)The timeout specified has expired: error reading from Lisp . After that I get HTTP 500 Server error. Please let me know how I can help to better diagnose the problem. If it'll help, I'll be glad to provide you off-list with details for ssh access to the machine exhibiting this behavior.
Thanks, Ury
On Mon, 22 Jan 2007 21:21:25 +0200, Ury Marshak urym@two-bytes.com wrote:
For testing I'm using a small python script that repeatedly uploads the same file, it's available at http://85.65.214.241/misc/test-upload.tar.gz
Yes, I can reproduce the error. It seems (from my understanding of the RFCs) the error is actually in the Python code - it sends two CRLF sequences after the last content boundary where it should only send one. (Firefox, IE, and Drakma for example don't do that.)
Anyway, I've tried to robustify Hunchentoot against erroneous client data like this. You should now only see a warning in the log file. I could upload 100 files in a row without problems using your test script.
Also note that the new release now optionally accepts request bodies without a content length when behind mod_lisp2. You'll need Hugh Winkler's latest additions to mod_lisp2 for this.
Cheers, Edi.
Edi Weitz wrote:
You should now only see a warning in the log file. I could upload 100 files in a row without problems using your test script.
Yes, thanks, the test works! Although I seem to have stumbled on a different issue with uploading. All it seems to take is to set the variable *hunchentoot-default-external-format* to utf-8. I.e. I start the hunchentoot test and evaluate: (setf hunchentoot:*hunchentoot-default-external-format* hunchentoot::+utf-8+)
After this when I try to upload a (non-ascii) file to the file upload test it fails (most of the time, although occasionally it works. I used the same script as before to test it and usually see failures within the first five attempts). Also it fails manually uploading from Firefox (Linux and Windows), also not all the time, but frequently enough. The message in the log says mostly just "[error] (32)Broken pipe: error writing to Lisp", but occasionally I get the "Error when creating REQUEST object: #<SB-SYS:FD-STREAM for "file /tmp/hunchentoot/hunchentoot-2" {BC3ABD1}> is closed."
Now, the following might not be relevant, but in an attempt to track it I've set (setf hunchentoot:*catch-errors-p* nil) and in the file request.lisp, method initialize-instance :after for request, after the line (log-message* "Error when creating REQUEST object: ~A" cond) I added (invoke-debugger cond)
This gave me the following backtrace:
encoding error on stream #<SB-SYS:FD-STREAM for "file /tmp/hunchentoot/hunchentoot-2" {AD456F9}> (:EXTERNAL-FORMAT :LATIN-1): the character with code 1491 cannot be encoded. [Condition of type SB-INT:STREAM-ENCODING-ERROR]
Restarts: 0: [OUTPUT-NOTHING] Skip output of this character. 1: [TERMINATE-THREAD] Terminate this thread (#<THREAD "hunchentoot-worker-2" {BB3E2A1}>)
Backtrace: 0: ((LAMBDA (SWANK-BACKEND::DEBUGGER-LOOP-FN)) #<FUNCTION (LAMBDA #) {AEE1E8D}>) 1: (SWANK::DEBUG-IN-EMACS #<SB-INT:STREAM-ENCODING-ERROR {AD491B9}>) 2: ((LAMBDA (SWANK-BACKEND::HOOK SWANK-BACKEND::FUN)) #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE (LAMBDA #) {AD493E5}>) 3: (SWANK::CALL-WITH-REDIRECTED-IO #<SWANK::CONNECTION {AE568F9}> #<CLOSURE (LAMBDA #) {AD493F5}>) 4: (SWANK::CALL-WITH-CONNECTION #<SWANK::CONNECTION {AE568F9}> #<CLOSURE (LAMBDA #) {AD493E5}>) 5: (INVOKE-DEBUGGER #<SB-INT:STREAM-ENCODING-ERROR {AD491B9}>) 6: (INVOKE-DEBUGGER #<SB-INT:STREAM-ENCODING-ERROR {AD491B9}>) 7: (HUNCHENTOOT::MAYBE-INVOKE-DEBUGGER #<SB-INT:STREAM-ENCODING-ERROR {AD491B9}>) 8: (SIGNAL #<SB-INT:STREAM-ENCODING-ERROR {AD491B9}>) 9: (ERROR SB-INT:STREAM-ENCODING-ERROR) 10: (SB-INT:STREAM-ENCODING-ERROR #<SB-SYS:FD-STREAM for "file /tmp/hunchentoot/hunchentoot-2" {AD456F9}> 1491) 11: (SB-INT:STREAM-ENCODING-ERROR #<SB-SYS:FD-STREAM for "file /tmp/hunchentoot/hunchentoot-2" {AD456F9}> 1491) 12: (SB-IMPL::STREAM-ENCODING-ERROR-AND-HANDLE #<SB-SYS:FD-STREAM for "file /tmp/hunchentoot/hunchentoot-2" {AD456F9}> 1491) 13: (SB-IMPL::OUTPUT-CHAR-LATIN-1-FULL-BUFFERED #<SB-SYS:FD-STREAM for "file /tmp/hunchentoot/hunchentoot-2" {AD456F9}> #\HEBREW_LETTER_DALET) 14: (WRITE-CHAR #\HEBREW_LETTER_DALET #<SB-SYS:FD-STREAM for "file /tmp/hunchentoot/hunchentoot-2" {AD456F9}>) 15: ((FLET RFC2388::RUN) #<SB-SYS:FD-STREAM for "file /tmp/hunchentoot/hunchentoot-2" {AD456F9}>) 16: (RFC2388::READ-UNTIL-NEXT-BOUNDARY #<FLEXI-STREAMS::FLEXI-UTF-8-IO-STREAM {BB46BA9}> "127.0.0.1.0.30734.1169595060.413.2" NIL #<SB-SYS:FD-STREAM for "file /tmp/hunchentoot/hunchentoot-2" {AD456F9}>) 17: (NIL #<unavailable argument> #<unavailable argument> #<FLEXI-STREAMS::FLEXI-UTF-8-IO-STREAM {BB46BA9}> "127.0.0.1.0.30734.1169595060.413.2") 18: (HUNCHENTOOT::PARSE-RFC2388-FORM-DATA #<FLEXI-STREAMS::FLEXI-UTF-8-IO-STREAM {BB46BA9}> "multipart/form-data; boundary=127.0.0.1.0.30734.1169595060.413.2") 19: (NIL (#(5 6 0 7 9 12 8 10) . #()) #<unavailable argument> #<HUNCHENTOOT::REQUEST {AD3BCC9}>)
(In any case I don't presume to fully understand the machinery involved, but the frames 13 and 16 seem to hint that the file content is decoded as UTF-8 and then written as LATIN-1 ? )
Thanks, Ury
On Wed, 24 Jan 2007 01:38:25 +0200, Ury Marshak urym@two-bytes.com wrote:
Although I seem to have stumbled on a different issue with uploading. All it seems to take is to set the variable *hunchentoot-default-external-format* to utf-8.
Yes, this was already discussed a few days ago
http://common-lisp.net/pipermail/tbnl-devel/2007-January/000983.html
but I couldn't reproduce it. Your little test script was again very helpful in this case... :)
I've now identified the error and just released a new version which should fix this.
Thanks, Edi.