-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[FIXED] A request through a service import with no interest should return no reponders. #6532
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have to look at this a bit more for message tracing to be sure that we don't go negative, but I can't do this today. If you know it is ok, then disregard my comment.
client.mu.Unlock() | ||
|
||
// For service imports, track if we delivered. | ||
didDeliver := true | ||
|
||
// Internal account clients are for service imports and need the '\r\n'. | ||
start := time.Now() | ||
if client.kind == ACCOUNT { | ||
sub.icb(sub, c, acc, string(subject), string(reply), msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would have the changes been too big to make msgHandler
(sub.icb
) return a boolean? I am guessing yes, but just checking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tried that and did not like the way the code was being changed, too much risk there IMO. So looking for alternative.
server/accounts.go
Outdated
if didDeliver := c.processServiceImport(si, acc, msg); !didDeliver { | ||
// We did not deliver to anything, so we will decrement the subs num messages. | ||
sub.client.mu.Lock() | ||
sub.nm-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum... not sure if that will always works. For instance, we bumped the sub.nm
only in the if !traceOnly {
case in deliverMsg. Not sure if I can't not come up with a test case that would cause this to become negative...
|
@derekcollison It will. Here is the changes I made to your PR, with printing the value of sub.nm before/after decrement, and replace the test's request with sending a request but as a trace-only message:
and here is the output:
|
I will switch msgHandler to return a bool, alot of changes to make but the correct approach versus my first attempt. |
Or, you could maybe add a new field in |
.. but I guess it would be the same since you would still need to go through all handlers to actually update this counter, which then better to have simply msgHandler() return a boolean. |
…th no responders. Signed-off-by: Derek Collison <derek@nats.io>
Signed-off-by: Derek Collison <derek@nats.io>
45e5397
to
037056d
Compare
ok I tried a different approach based on @kozlovic suggestion which I think works well. Will see if all tests are green. Could @neilalexander and @kozlovic take another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Since service imports are internal callbacks with no signaling for delivered status, when sending through a service import with no interest in the exporting account, the requestor would simply timeout.
Signed-off-by: Derek Collison derek@nats.io