nchan
nchan copied to clipboard
The value of "active subscribers" is incorrect
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.
Can anyone help to fix this problem?
Sorry, I've been a bit busy this past week. I'll look into this and have more questions or a fix soon.
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.
The issue is with the counter, there's no resource leak going on here. I'll have it fixed in the next release.
OK, I got it, thanks.
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.