-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vcmp filter with operator "spy.NE" not working properly #160
Comments
I just noticed the zorka logfile gets a new entry every time a filter applies/matches: Then, I saw some TODO comment in the DispatchingSubmitter: Does that mean, there's no implementation for this case yet? |
Ah thank you. Unfortunately when I was implementing ComparatorProcessor I tried to be "clever" and this resulted in unreadable mess that is now bringing such nasty bugs you've discovered. Now I'm integrating your fix into mainline codebase, maybe later on I'll try to rethink and rewrite this piece into a more decent form :) Thanks (and sorry for delayed answer). |
Regarding DispatchingSubmitter: in principle this situation should not happen. At the beginning of each instrumented method [.onEnter()] a newly created context object is put onto stack. On return [.onReturn(),.onError(),.onSubmit()] context is popped out of the stack, so information grabbed at method entry can be reused after method execution. There is a bunch of corner cases as well, for example you can have only .onEnter() chain defined, so only method entry will be instrumented. This is somewhat delicate situation as one needs to keep context stack in sync with instrumented code execution. Agent tries to handle such cases as well (at least those I've envisioned or encountered) but no one says there are no additional ones. In order not to break monitored code, spy cannot just crash - it handles such 'unexpected' situations (that shouldn't happen) by issuing log message. It might be either a bug in intrumentation engine itself or beanshell instrumentation definitions (or even BSH functions when used inside instrumentation chains). For me this indicates that the particular case you've encountered should be isolated and debugged. Ignoring these messages will lead to a number of dropped (or only partially executed) monitorings of instrumented method. |
Thanks for your reply. .onEnter( I am instrumenting: |
So here we are. If spy.vcmp(...) stops .onEnter() chain (and that's how filters work - they stop chain execution), it will result in context not being pushed onto stack. Try something like this: .onEnter( Function spy.subchain() will group another elements into a (sub-)chain that will return context even if chain execution will be stopped. |
Every time you do some kind of filtering in .onEnter() and then have either .onReturn(), .onError() or .onSubmit() defined, you need to be careful about always returning something. Maybe I should handle this case more gracefuly (eg. push null into stack - to ensure that exit chains won't execute in more controlled way). |
Works like a charm, thank you! |
Due to a bug in the ComparatorProcessor, there is no difference between using the "spy.NE" and "spy.EQ" operator in a filter.
It's always the "spy.EQ" logic.
In the "process" method:
} else if (op == EQ || op == NE) {
return ((va == null && vb == null) || (va != null && va.equals(vb))) ? record : null;
}
Should be something like:
} else if (op == EQ) {
return ((va == null && vb == null) || (va != null && va.equals(vb))) ? record : null;
} else if (op == NE) {
return ((va == null && vb == null) || (va != null && !va.equals(vb))) ? record : null;
}
I recompiled it with changed sources and it works perfectly now.
(Hint: If you're a Windows user, make sure there are no blanks in the path of your source directory, otherwise unit tests will fail)
The text was updated successfully, but these errors were encountered: