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