ArrayBuffer/Uint8Array stuff not working in nightly #24

Closed
mhammond opened this Issue Mar 28, 2012 · 5 comments

Projects

None yet

3 participants

@mhammond
Mozilla member

Nightly from the last day or 2 is having issues with our ArrayBuffer/Uint8Array dances. The problem manifests itself as errors:

2012-03-28T07:01:50.339Z [mqtt]: Malformed message
2012-03-28T07:01:50.343Z [mqtt]: ERROR parsing onmessage: TypeError: parsedCommand is undefined

digging deeper the problem is connection.parse is attempting to parse zero bytes. Digging deeper still - I changed the first few lines of connection.parse to read:

mqttlog("got a rawBuffer with size " + rawBuffer.byteLength);
var buf = new Uint8Array(rawBuffer);
mqttlog("resulting array has size " + buf.length);

and the output from this is:

2012-03-28T06:59:53.661Z [mqtt]: got a rawBuffer with size 4
2012-03-28T06:59:53.664Z [mqtt]: resulting array has size 0

So somehow we are getting a zero byte array from a 4 byte message buffer. A trivial test can't reproduce this.

sigh

@mhammond
Mozilla member

"fixing" that assertion in nightly seems to have caused us to then hit bug 734215 which Mike opened earlier this month. double sigh

@michaelrhanson
Mozilla member

I note that the current workaround does not work:

2012-05-07T22:10:08.395Z [mqtt]: ERROR parsing onmessage: TypeError: workerWindow.Uint8Array is not a constructorStack trace:
([object Proxy])@resource://socialdev/modules/frameworker.js:430

line #430 is:

        // And a very hacky work-around for bug 734215
        workerWindow.bufferToArrayHack = function(a) {
            return new workerWindow.Uint8Array(a);
        };
        sandbox.importFunction(workerWindow.bufferToArrayHack, "bufferToArrayHack");
@michaelrhanson michaelrhanson reopened this May 7, 2012
@michaelrhanson
Mozilla member

Whoops, clicked the wrong button. NOT closed.

@mhammond
Mozilla member

I can't repro this anywhere and Shane doesn't seem to be able to either. I also changed fbworker.js:

   // var buf = new Uint8Array(rawBuffer);
   var buf = bufferToArrayHack(rawBuffer);
+  dump("bufferToArrayHack made " + buf + "\n");

and it constantly prints:

bufferToArrayHack made [object Uint8Array]

This is in FF, Aurora and Nightly, all up-to-date. So I'm not sure what is going on...

@mixedpuppy mixedpuppy closed this May 14, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment