nchan icon indicating copy to clipboard operation
nchan copied to clipboard

The value of "active subscribers" is incorrect

Open win911 opened this issue 7 years ago • 6 comments

Hi I'm aware of #216 and #289 but I doubt it's related, so I'm opening another issue:

I use nchan v1.1.7

This is my config:

server { listen 127.0.0.1:1234;

location ~ /channel/hb_sub/(\w+)$ {
  nchan_subscriber;
  nchan_subscriber_first_message newest;
  nchan_subscriber_compound_etag_message_id on;
  nchan_longpoll_multipart_response raw;
  nchan_subscriber_timeout 10;
  nchan_channel_id "hb_$1" "hb_broadcast";
}

location ~ /channel/hb_pub/(\w+)$ {
  nchan_publisher;
  nchan_message_buffer_length 1;
  nchan_message_timeout 300s;
  nchan_channel_id "hb_$1";
}

location = /channel/hb_broadcast {
  nchan_publisher;
  nchan_message_buffer_length 1;
  nchan_message_timeout 300s;
  nchan_channel_id hb_broadcast;
}

location = /channel/status {
  nchan_stub_status;
}

}

I subscribed to the channel by: $ curl -v --request GET http://127.0.0.1:1234/channel/hb_sub/test

After 10s, I got 408 Request Timeout, and then I checked the channel info by: $ curl --request GET http://127.0.0.1:1234/channel/hb_pub/test

I found the value of "active subscribers" was 1. So I did the above steps again and then found it was changed to be 2.

But if I changed the row 'nchan_channel_id "hb_$1" "hb_broadcast";' to be 'nchan_channel_id "hb_$1";', the value of "active subscribers" was correct => 0 after I got the response

I think this only happens if nchan_channel_id has 2 or more channels.

win911 avatar Aug 03 '17 10:08 win911

Can anyone help to fix this problem?

win911 avatar Aug 10 '17 02:08 win911

Sorry, I've been a bit busy this past week. I'll look into this and have more questions or a fix soon.

slact avatar Aug 10 '17 17:08 slact

Is there any progress yet? Sorry, I don't want to put pressure on you, I just wanna know it is just a incorrect number or it is a problem which will cause resources not be released.

win911 avatar Sep 04 '17 02:09 win911

The issue is with the counter, there's no resource leak going on here. I'll have it fixed in the next release.

slact avatar Sep 07 '17 04:09 slact

OK, I got it, thanks.

win911 avatar Sep 08 '17 02:09 win911

Was this ever fixed? With latest release (minus the commit referenced in #534) and throwing lots of subscribres on single worker process, it does not seem to decrement properly once longpolling-subscribers are gone.

stromnet avatar Dec 05 '19 15:12 stromnet