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.

Failed to close writer connection

See original GitHub issue

Hi

I’m running nsqd by docker with latest tag and use this library to write message to the nsqd, below is a part of my source code:

...skip

publish(topic, message) {
    const nsqWriter = new nsq.Writer(
      this.nsqHost,
      this.nsqPort,
    );

    return new Promise((resolve, reject) => {
      nsqWriter.connect();
      nsqWriter.once('error', err => reject(err));
      nsqWriter.once('ready', () => {
        nsqWriter.publish(topic, message, (err) => {
          if (err) reject(err);
          nsqWriter.close();
        });

        nsqWriter.once('closed', () => resolve());
      });
    });
  }

If I use the latest version of this lib (v0.9.2), nsqWriter.close(); will lead to Error: E_INVALID cannot CLS in current state (nsqd logging the same error too when I open -verbose flag), however when I downgrade version to v0.8.4 then everything is working fine.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Misiucommented, Mar 16, 2021

@dudleycarr please let me know when you fix this. I’ll be more than happy to test the changes.

1reaction
dudleycarrcommented, Mar 4, 2021

Looks like it’s only appropriate to use the CLS protocol command when using a Reader. See here: https://github.com/nsqio/nsq/blob/c164c776ab1af72706fff6cc05cd80a36771811d/nsqd/protocol_v2.go#L753

I’ll make a change to remove sending CLS for Writer.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting error while trying to close text writer - Stack Overflow
Getting error while trying to close text writer ; import java.io.FileNotFoundException; import ; MedConcept { public ; (String[] args) { ...
Read more >
Closing AMQP connection frequently with errors {writer ...
> I see too many {writer,send_failed,{error,timeout}} in rabbitmq logs. This means socket writes fail due to timeout (from the RabbitMQ end).
Read more >
"WRT_8376 : Writer encounters a connection failure ... - ERROR
In PowerCenter, random sessions fail intermittently with the following error in multiple session logs: Database driver error.
Read more >
Error: listener: closing connection: unable to write reply of length
I just installed the New Relic agent on a server to test and I am getting this error: Error: listener: closing connection: unable...
Read more >
Oracle JDBC connection cannot be closed properly
Because my program failed to close the connection, it put this connection into a list so that a background thread was able to...
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