Problems with getting 404 errors when loading images from binary Blob's passed over websocket and using createObjectURL

1,409 views
Skip to first unread message

rang...@googlemail.com

unread,
Jul 5, 2014, 2:52:29 PM7/5/14
to chromium...@chromium.org
Hi

Not sure if this is the best place to raise this?

Chrome Version 35.0.1916.153 m :
Chrome Version 38.0.2068.0 canary (64-bit) Canary (chrome://flags/#impl-side-painting setting makes no difference).


This issue is described in more depth in my response on  a 'stack overflow' discussion originaly raised by another user. I've added my similar finding to this.  


I'm running a localhost c++ websocket server passing png binary images to a browser via SSL websockets at about 10fps with 500MB images. For testing the server is cycling through returning 10 preloaded png images in order. On the browser I I receive each message as a Blob and use createObjectURL to make a URL that I pass to image.src. In the image.onload I paint the image, call  revokeObjectURL(this.src) and then send a message to the websocket server to request the next binary png.  I'm using a single Image object rather than creating one for every message

Running my program results in chrome consuming lots of memory and also my messages stop appearing. Eventually chrome/canary crashes. Running the same code on IE and Firefox results in no errors.


I eventually realised this was because I was getting sometimes getting 404 errors when the image was trying to load the URL. Thus in image.onerror I now call  revokeObjectURL(this.src) and also here  send a message to the websocket server to request the next binary png. This sorted out my memory issues.

After approx 900 successful image loads I start getting 404 load failures. then after maybe after 50 failures, I start getting successful loads again. This pattern keeps repeating, but the numbers seem random.  

I cannot see any reason I should be able to get this 404 error.

What is strange is I can get round this whole problem by changing the websocket.binaryType to 'arraybuffer'. And then making a new Blob from a new Uint8Array(evt.data). I then get 100% successful image loads.


Any input would be appreciated.

cheers

matt

rang...@googlemail.com

unread,
Jul 6, 2014, 3:03:19 PM7/6/14
to chromium...@chromium.org
Sorry, Image size was 0.5 MB not 500 MB.



 

rang...@googlemail.com

unread,
Jul 7, 2014, 9:09:57 AM7/7/14
to chromium...@chromium.org

So I've being doing more testing, and things seem very stable if I make my own Blobs using websocket.binaryType='arraybuffer'. So why do things go wrong if I set websocket.binaryType='blob' and use the supplied Blobs?

 


 

Chris Bentzel

unread,
Jul 8, 2014, 9:09:40 AM7/8/14
to rang...@googlemail.com, Takeshi Yoshino, Chromium-discuss
> --
> --
> Chromium Discussion mailing list: chromium...@chromium.org
> View archives, change email options, or unsubscribe:
> http://groups.google.com/a/chromium.org/group/chromium-discuss
>

Takeshi Yoshino

unread,
Jul 8, 2014, 10:10:52 AM7/8/14
to Chris Bentzel, rang...@googlemail.com, Chromium-discuss
WebSocket in Chromium basically does almost the same thing to build a MessageEvent containing a Blob as what the Blob constructor does.

Filed a bug. We'll investigate code to see if there's any difference between them, and update the bug with progress.

Thanks

Takeshi

rang...@googlemail.com

unread,
Jul 8, 2014, 5:29:03 PM7/8/14
to chromium...@chromium.org, cben...@chromium.org, rang...@googlemail.com
Thanks for the response ...

Matt 
Reply all
Reply to author
Forward
0 new messages