question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: write after end

See original GitHub issue

I’m trying to get a list of all open windows. Seems to me like an actual issue with node-x11 and not x11 itself:

This is the stacktrace:

Error: write after end
    at writeAfterEnd (_stream_writable.js:193:12)
    at Socket.Writable.write (_stream_writable.js:244:5)
    at Socket.write (net.js:658:40)
    at UnpackStream.<anonymous> (/home/user/app/node_modules/x11/lib/xcore.js:82:16)
    at emitOne (events.js:96:13)
    at UnpackStream.emit (events.js:188:7)
    at UnpackStream.flush (/home/user/app/node_modules/x11/lib/unpackstream.js:311:15)
    at XClient.req_proxy [as GetProperty] (/home/user/app/node_modules/x11/lib/xcore.js:231:37)
    at X.InternAtom (/home/user/app/x11-wrapper.js:99:7)
    at ReadFixedRequest.callback (/home/user/app/node_modules/x11/lib/xcore.js:545:21)

This is the code I’m running:

X.InternAtom(false, '_NET_CLIENT_LIST', (err, atomId) => {
    console.log(atomId);
    X.GetProperty(0, root, atomId, X.atoms.CARDINAL, 0, 100000, (err, prop) => {
      console.log('HERE', prop.data, prop.data.toString());
    });
  });

_NET_CLIENT_LIST_STACKING and _WIN_CLIENT_LIST result in the same error. So does leaving out the additional parameters.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
johannesjocommented, Sep 27, 2019

My bad. The issue was recreating and terminating the x11 server for every command I executed…

0reactions
johannesjocommented, Sep 27, 2019

I get the same when I try to get all the properties of a window, like in this smoke test:

    X.ListProperties(id, function(err, props) {
        props.forEach(function(p) {
            X.GetProperty(0, id, p, 0, 0, 10000000, function(err, propValue) {
                X.GetAtomName(propValue.type, function(err, typeName) {
                    X.GetAtomName(p, function(err, propName) {
                        decodeProperty(typeName, propValue.data, function(decodedData) {
                            console.log(propName + '(' + typeName + ') = ' + decodedData);
                        });
                    });
                });
            });
        })   
    });
    X.on('event', console.log);
    X.on('error', console.error);
Error [ERR_STREAM_WRITE_AFTER_END]: write after end
    at writeAfterEnd (_stream_writable.js:243:12)
    at Socket.Writable.write (_stream_writable.js:291:5)
    at UnpackStream.<anonymous> (/home/user/myproject/node_modules/x11/lib/xcore.js:82:16)
    at UnpackStream.emit (events.js:189:13)
    at UnpackStream.flush (/home/user/myproject/node_modules/x11/lib/unpackstream.js:311:15)
    at XClient.req_proxy [as GetProperty] (/home/user/myproject/node_modules/x11/lib/xcore.js:231:37)
    at /home/user/myproject/lib/x11Wrapper.js:222:9
    at Array.forEach (<anonymous>)
    at /home/user/myproject/lib/x11Wrapper.js:221:11
    at ReadFixedRequest.callback (/home/user/myproject/node_modules/x11/lib/xcore.js:545:21)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Write After End error in node.js webserver
I am struggling with my node.js hobby project due to a "write after end" Error. I have a created a node.js webserver that...
Read more >
write after end · Issue #928 · tulios/kafkajs - Connection error
After the update, we noticed that a new error is logged in our production server: Message: Connection error: write after end Stack: Error ......
Read more >
Server crashes with even simplest code. : r/node
this is error events.js:352 throw er; // Unhandled 'error' event Error [ERR_STREAM_WRITE_AFTER_END]: write after end at writeAfterEnd…
Read more >
Error: write after end (Example)
Node is asynchronous, which means that functions happen at the same time. Write after end means that something is being written after the...
Read more >
[ERR_STREAM_WRITE_AFTER_END]: write after end
Hey guys! I use aws-sdk for NodeJS for Linode Object Storage but I get the following error `[ERR_STREAM_WRITE_AFTER_END]: write after end` when uploading ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found