-
-
Notifications
You must be signed in to change notification settings - Fork 35.1k
Open
Labels
bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.questionIssues that look for answers.Issues that look for answers.
Description
- Version: 14.15.1
- Platform: 5.4.0-45-generic debugger: use requireRepl() to load debugger repl #49-Ubuntu SMP Wed Aug 26 13:38:52 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
- Subsystem: Buffer
What steps will reproduce the bug?
I'm getting the data from the stream as a Buffer 24 bytes long, which contains different data each time called. In the callback I'm trying to split the buffer into two, and log the two new buffers:
// data is an instance of Buffer, 24 bytes long, and changing each time called (which is dozens of times per second)
console.log('data1:', data);
const timestamp = Buffer.from(data.buffer, 0, 16);
const eventType = Buffer.from(data.buffer, 16, 24);
console.log('data2:', timestamp, eventType); // <- showing stale dataWhat is going on?
Even though my first console.log shows the correct data, the second console.log is showing the stale data for the next events (calls), and only after 12 seconds it updates, and then the next 12 seconds it shows the stale data again, and so on.
How often does it reproduce? Is there a required condition?
Always.
What is the expected behavior?
The second console.log should show the same underlying data as the first console.log
What do you see instead?
I see the stale data
data1: <Buffer 4c 0f c5 5f 00 00 00 00 96 12 00 00 00 00 00 00 02 00 00 00 ff ff ff ff>
data2: <Buffer 4c 0f c5 5f 00 00 00 00 96 12 00 00 00 00 00 00> <Buffer 02 00 00 00 ff ff ff ff>
data1: <Buffer 4d 0f c5 5f 00 00 00 00 96 12 00 00 00 00 00 00 02 00 00 00 ff ff ff ff>
data2: <Buffer 4c 0f c5 5f 00 00 00 00 96 12 00 00 00 00 00 00> <Buffer 02 00 00 00 ff ff ff ff>
Note that in the second pair of outputs data1 changed the first byte, but data2 remained stale.
Additional information
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bufferIssues and PRs related to the buffer subsystem.Issues and PRs related to the buffer subsystem.questionIssues that look for answers.Issues that look for answers.