-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parallel and corrupted data? #328
Comments
Will need to do some more testing but so far that seems to have solved it. Looking forward to the next release :). |
Nope. Still a problem. |
Do you know why the data is corrupted? Are the Buffers being dropped or reordered? |
It's very difficult to tell. It's H264 video buffers that are sent to ffplay. Analysing a H264 bitstream is a bit complicated. |
Hmm, I tried reading a bunch of local files via I've pushed a debug branch here: https://github.com/vqvu/highland/tree/parallel-debug (vqvu/highland#parallel-debug). Can you run this code against that branch? It should track the order of buffers that request emits and tell you if anything is wrong. Don't forget to var counter = [];
var i = 0;
var checkState = {
urlIndex: 0,
bufIndex: 0
};
// Check correct version
_.whatAmI();
// => Highland 2.x. debug-parallel edition
stream.map(url => _(request.get(url)))
.map(function (s) {
var urlIndex = i++;
counter[urlIndex] = 0;
return s.map(function (buf) {
return {
index: [urlIndex, counter[urlIndex]++],
buf: buf,
};
});
})
.parallel(8)
.map(function (obj) {
if (obj.index[0] === checkState.urlIndex + 1) {
checkState.urlIndex++;
checkState.bufIndex = 0;
}
if (obj.index[0] === checkState.urlIndex) {
if (obj.index[1] !== checkState.bufIndex) {
console.log('Corrupt data.', checkState, obj.index);
}
checkState.bufIndex++;
}
else {
console.log('Corrupt data.', checkState, obj.index);
}
return obj.buf;
})
.through(decoder()) |
How do I checkout a branch with npm? http+git@github.com:vqvu/highland.git...something |
See also, #330, with which I have no issues, so far. |
@ronag you can run |
(depending on your shell, you might need to escape the |
Ok, I think I have a broken test case. Will type up the fix soon-ish. Though I'm not sure if this is the problem you're encountering or not. var s1 = _([1, 2, 3]);
var s2 = _([11, 12, 13]);
_([s1.fork(), s2, s1.fork()])
.parallel(3)
.consume(function (err, x, push, next) {
push(err, x);
if (x.buf === 21) {
// Pause for a while.
setTimeout(next, 1000);
}
else if (x !== _.nil) {
next();
}
})
.toArray(_.log);
// => [ 1, 2, 3, 11, 12, 13 ]
// should be
// => [ 1, 2, 3, 11, 12, 13, 1, 2, 3 ] Basically, when
then anything that |
Can you try testing against the code in #331?
|
Will do later today. |
That seems to have solved it. I haven't seen any corruption so far with the same test cases. |
Please reopen if you run into the problem again. |
I've noticed a strange occurrence. I'm reading raw compressed data from multiple files and then concatenating them:
However, this results sometimes in corrupted data.
While the following works just fine:
I don't have any reproducible example yet. The problem is somewhat intermittent.
The text was updated successfully, but these errors were encountered: