Closed GeorgeAnanthSoosai closed 8 years ago
here is the new stack trace,
21:03:04.954409 OCR_HTTP: request to ocr-file-upload 21:03:04.956970 OCR_HTTP: content type: multipart/related; boundary=---BOUNDARY 21:03:04.957151 OCR_HTTP: content type: multipart/related 2016/09/28 21:03:04 http: panic serving 192.168.99.1:53799: runtime error: invalid memory address or nil pointer dereference goroutine 26 [running]: net/http.func009() /usr/lib/go/src/pkg/net/http/server.go:1093 +0xae runtime.panic(0x6afb80, 0xa21f28) /usr/lib/go/src/pkg/runtime/panic.c:248 +0x106 github.com/tleyden/open-ocr.(_OcrHttpMultipartHandler).extractParts(0xc21000a550, 0xc210068ea0, 0xc210053fc5, 0x1007f4400000000, 0x1, ...) /opt/go/src/github.com/tleyden/open-ocr/ocr_http_multipart_handler.go:52 +0x5b5 github.com/tleyden/open-ocr.(_OcrHttpMultipartHandler).ServeHTTP(0xc21000a550, 0x7f440d7dc7e0, 0xc21000fc80, 0xc210068ea0) /opt/go/src/github.com/tleyden/open-ocr/ocr_http_multipart_handler.go:94 +0x77 net/http.(_ServeMux).ServeHTTP(0xc21001e840, 0x7f440d7dc7e0, 0xc21000fc80, 0xc210068ea0) /usr/lib/go/src/pkg/net/http/server.go:1496 +0x163 net/http.serverHandler.ServeHTTP(0xc21000a5f0, 0x7f440d7dc7e0, 0xc21000fc80, 0xc210068ea0) /usr/lib/go/src/pkg/net/http/server.go:1597 +0x16e net/http.(_conn).serve(0xc21005cc00) /usr/lib/go/src/pkg/net/http/server.go:1167 +0x7b7 created by net/http.(*Server).Serve /usr/lib/go/src/pkg/net/http/server.go:1644 +0x28b
Does not look like an open-ocr issue, closing.
←[35mopenocrworker_1 |←[0m } ←[35mopenocrworker_1 |←[0m 19:04:18.229602 ←[33mOCR_WORKER: ←[0msendRpcR esponse to: amq.gen-w3Lgz8oGE9BQVBlBwk91KA ←[35mopenocrworker_1 |←[0m 19:04:18.230123 ←[33mOCR_WORKER: ←[0msendRpcR esponse succeeded ←[32mopenocr_1 |←[0m 19:04:22.728360 ←[33mOCR_HTTP: ←[0mrequest to ocr-file-upload ←[32mopenocr_1 |←[0m 19:04:22.729076 ←[33mOCR_HTTP: ←[0mcontent ty pe: multipart/related; boundary=---BOUNDARY ←[32mopenocr_1 |←[0m 19:04:22.729762 ←[33mOCR_HTTP: ←[0mcontent ty pe: multipart/related ←[32mopenocr_1 |←[0m 2016/09/28 19:04:22 http: panic serving 192.1 68.99.1:52538: runtime error: index out of range ←[32mopenocr_1 |←[0m goroutine 178 [running]: ←[32mopenocr_1 |←[0m net/http.func┬╖009() ←[32mopenocr_1 |←[0m /usr/lib/go/src/pkg/net/http/server.go:1 093 +0xae ←[32mopenocr_1 |←[0m runtime.panic(0x6afb80, 0xa22117) ←[32mopenocr_1 |←[0m /usr/lib/go/src/pkg/runtime/panic.c:248 +0x106 ←[32mopenocr_1 |←[0m github.com/tleyden/open-ocr.(_OcrHttpMultipar tHandler).extractParts(0xc21000a550, 0xc210063340, 0xc2100af665, 0x1007ff5000000 00, 0x1, ...) ←[32mopenocr_1 |←[0m /opt/go/src/github.com/tleyden/open-ocr/ ocr_http_multipart_handler.go:52 +0xbca ←[32mopenocr_1 |←[0m github.com/tleyden/open-ocr.(_OcrHttpMultipar tHandler).ServeHTTP(0xc21000a550, 0x7ff5825247e0, 0xc21000f780, 0xc210063340) ←[32mopenocr_1 |←[0m /opt/go/src/github.com/tleyden/open-ocr/ ocr_http_multipart_handler.go:94 +0x77
Code i used is :
let startContent = "-----BOUNDARY \n \ \"Content-Type\": \"application/json\" \n \ \ {\"engine\":\"tesseract\"} \n \ -----BOUNDARY \n \ \ -----BOUNDARY \n \ \"Content-Type\": \"image/PNG\" \n \ \"Content-Disposition\" : \"attachment; filename=\'imagePicture.PNG\'\".\ \n";
} handleError(error) { return Observable.throw(error.json() || 'Server error'); }
genMultipart(image, beforeContent, boundary) { var raw = atob(image); var rawLength = raw.length; var imageBinary = new Uint8Array(new ArrayBuffer(rawLength)); for(i = 0; i < rawLength; i++) { imageBinary[i] = raw.charCodeAt(i); } var before = [beforeContent, "\n\n"].join(''); var after = '\n' + boundary; var size = before.length + imageBinary.byteLength + after.length; var uint8array = new Uint8Array(size); var i = 0;
} }