-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Memos highlight sync fails with error in decode.lua #12018
Comments
I'm afraid it doesn't work that way. The invalid decoding happens in https://github.com/koreader/koreader/blob/master/plugins/exporter.koplugin/target/memos.lua#L41
That tell us the server response wasn't valid. The crash is entirely our fault. If the json is malformed we should return @fierceX: could you please look in to the issue?. If memos server can reply invalid json I think we should put |
I used mitmproxy to capture the queries issued by KOReader. Only one query is made before the crash occurs. Here is the query made by KOReader to the Memos instance: {"content":"Debugging Checklist\nIs the problem being reported a direct result of the underlying bug, or merely a symptom?\nIs the bug really in the framework you’re using? Is it in the OS? Or is it in your code?\nIf you explained this problem in detail to a coworker, what would you say?\nIf the suspect code passes its unit tests, are the tests complete enough? What happens if you run the tests with this data?\nDo the conditions that caused this bug exist anywhere else in the system? Are there other bugs still in the larval stage, just waiting to hatch?\n\nThe Pragmatic Programmer - 20th Anniversary Edition (page: 229)\n\n #The_Pragmatic_Programmer_-_20th_Anniversary_Edition #koreader"} The response headers are:
Here is the memos server JSON reply: {"name":"memos/27", "uid":"MXNpoJ8un8qun7EJSKvZW2", "rowStatus":"ACTIVE", "creator":"users/1", "createTime":"2024-06-13T04:10:18Z", "updateTime":"2024-06-13T04:10:18Z", "displayTime":"2024-06-13T04:10:18Z", "content":"Debugging Checklist\nIs the problem being reported a direct result of the underlying bug, or merely a symptom?\nIs the bug really in the framework you’re using? Is it in the OS? Or is it in your code?\nIf you explained this problem in detail to a coworker, what would you say?\nIf the suspect code passes its unit tests, are the tests complete enough? What happens if you run the tests with this data?\nDo the conditions that caused this bug exist anywhere else in the system? Are there other bugs still in the larval stage, just waiting to hatch?\n\nThe Pragmatic Programmer - 20th Anniversary Edition (page: 229)\n\n #The_Pragmatic_Programmer_-_20th_Anniversary_Edition #koreader", "nodes":[{"type":"PARAGRAPH", "paragraphNode":{"children":[{"type":"TEXT", "textNode":{"content":"Debugging Checklist"}}]}}, {"type":"LINE_BREAK", "lineBreakNode":{}}, {"type":"PARAGRAPH", "paragraphNode":{"children":[{"type":"TEXT", "textNode":{"content":"Is the problem being reported a direct result of the underlying bug, or merely a symptom?"}}]}}, {"type":"LINE_BREAK", "lineBreakNode":{}}, {"type":"PARAGRAPH", "paragraphNode":{"children":[{"type":"TEXT", "textNode":{"content":"Is the bug really in the framework you’re using? Is it in the OS? Or is it in your code?"}}]}}, {"type":"LINE_BREAK", "lineBreakNode":{}}, {"type":"PARAGRAPH", "paragraphNode":{"children":[{"type":"TEXT", "textNode":{"content":"If you explained this problem in detail to a coworker, what would you say?"}}]}}, {"type":"LINE_BREAK", "lineBreakNode":{}}, {"type":"PARAGRAPH", "paragraphNode":{"children":[{"type":"TEXT", "textNode":{"content":"If the suspect code passes its unit tests, are the tests complete enough? What happens if you run the tests with this data?"}}]}}, {"type":"LINE_BREAK", "lineBreakNode":{}}, {"type":"PARAGRAPH", "paragraphNode":{"children":[{"type":"TEXT", "textNode":{"content":"Do the conditions that caused this bug exist anywhere else in the system? Are there other bugs still in the larval stage, just waiting to hatch?"}}]}}, {"type":"LINE_BREAK", "lineBreakNode":{}}, {"type":"LINE_BREAK", "lineBreakNode":{}}, {"type":"PARAGRAPH", "paragraphNode":{"children":[{"type":"TEXT", "textNode":{"content":"The Pragmatic Programmer - 20th Anniversary Edition (page: 229)"}}]}}, {"type":"LINE_BREAK", "lineBreakNode":{}}, {"type":"LINE_BREAK", "lineBreakNode":{}}, {"type":"PARAGRAPH", "paragraphNode":{"children":[{"type":"TEXT", "textNode":{"content":" "}}, {"type":"TAG", "tagNode":{"content":"The_Pragmatic_Programmer_-_20th_Anniversary_Edition"}}, {"type":"TEXT", "textNode":{"content":" "}}, {"type":"TAG", "tagNode":{"content":"koreader"}}]}}], "visibility":"PRIVATE", "tags":[], "pinned":false, "resources":[], "relations":[], "reactions":[], "property":{"tags":["The_Pragmatic_Programmer_-_20th_Anniversary_Edition", "koreader"], "hasLink":false, "hasTaskList":false, "hasCode":false, "hasIncompleteTasks":false}} |
After investigation, the issue is caused by the table sink. A solution is, on line 41, use local response = json.decode(table.concat(sink)) I've tested it. It works. It doesn't solve the issue of the unprotected call to |
Issue
When syncing highlight to Memos, KOReader crash. See crashlog.
Steps to reproduce
The book metadata file is metadata.epub.lua.gz.
It should contain the value causing the decoding issue.
crash.log
(if applicable)crash.log
The text was updated successfully, but these errors were encountered: