-
Notifications
You must be signed in to change notification settings - Fork 405
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
mloginfo --queries crash "TypeError: Object of type bytes is not JSON serializable" #764
Comments
@stennie any suggested "hidden" command line options that could generate a more verbosely output while processing the log, to help pinpoint the error generating lines? |
@bugre There aren't any hidden verbosity options, but it would be useful to add some log context for exceptions (I just created #767 for this). To troubleshoot If you are able to share a subset of the log privately (or recreate this with clean data), I could also extrapolate a test case. Regards, |
Hi @stennie , I'll need a little more time to understand why and propose a solution. Thanks, |
Hi @stennie , Question, what should be the output of filter patter processing for this test string (file: mtools/utils/pattern.py). Specifically looking at the
Should it be: or should it be something like?: Thanks |
log entry to reproduce the error and test the fix..Adding a one line log entry that can be used to generate the error (before fixing) and after applying the PR #768 it should not crash anymore.
|
The latter example is the expected output of
Ideally we try to keep unrelated issues in separate commits so a PR with several related commits can be squashed for easy diffing of changes in future. If you are referring to the commits in the PR for JSON encoding and removing Regards, |
Thank you for the clarification Stephen. |
This line gives the same error and stacktrace without any obvious unicode chars:
|
Hi @niccottrell , I've tested you'r log line with my proposed PR and it does indeed work, but the resulted simplification is not exactly what i've would have expected. But in this case, the simplification is done by an already existing code in
@stennie , this line I could change the code i've added for the simplification of cases like "{... "attrib" : ["val1", "val2", "3"],...}" to "{..."atrib" : [1],... }":
This would simplify the above log entry:
BUT, this also changes entries like the one bellow ('Input'), so that the result will be the shown in "Output" and not the one in "Expect" that is generated today:
|
It's a pattern with list of url '$all : [ "https://xxxxx.xx" ] ..' See comment at rueckstiess#764 (comment)
i've added one more commit ( 5ba18b3), where i change the regex
both cases that i mention above (on my last comment) are handled correctly (as i understand). @niccottrell use case, is simplified to Finally this also improves the regex and avoids the simplifying error that happened if a "]" was part of a list value. This case is now also correctly handled. With this, if no other use cases are handled wrongly or need improvements, i would consider this PR finished and ready for your evaluation. Let me know if there are coding or style adjustments. |
It's a pattern with list of url '$all : [ "https://xxxxx.xx" ] ..' See comment at #764 (comment)
Actual/current behavior
Crash when running.
Crashes when running with
--queries
.But, does NOT crash running with
--connections
for example. So i think it's related to some specific query parameter or values.I can confirm that the problem reported at #684 still exist with the latest version of mtools (tested with latest mtools 1.6.0 release, also with develop branch) and python 3.7.6 (before was using 3.6 with same results, upgraded as a trial to fix the issue :), but no.
Steps to reproduce the actual/current behavior
Simply run:
mloginfo --verbose --queries ./mongod.log
generates the crash with this traceback.Environment
Others..
I'll try to reduce the log to reasonable size and sanitise it while still getting it to generate the error (now it's around 4GB and has a lot of private data). And if i get the time, try to troubleshoot it a little and report back or suggest a possible fix if i'm able to do it.
The text was updated successfully, but these errors were encountered: