Skip to content
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

Crash after TTRSS update past commit 2adf364c2c: Caused by: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 84 path $.content.config #451

Closed
aruberutsu opened this issue May 21, 2021 · 3 comments

Comments

@aruberutsu
Copy link

After upgrading TTRSS instance to commit 2adf364c2c or newer, TTRSS-Reader will crash on login with the following error:

2021-05-21 16:10:44.256 6613-6662/org.ttrssreader E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #3
    Process: org.ttrssreader, PID: 6613
    java.lang.RuntimeException: An error occurred while executing doInBackground()
        at org.ttrssreader.utils.AsyncTask$4.done(AsyncTask.java:218)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
        at java.util.concurrent.FutureTask.run(FutureTask.java:271)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)
     Caused by: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 84 path $.content.config
        at com.google.gson.stream.JsonReader.nextString(JsonReader.java:826)
        at org.ttrssreader.net.JSONConnector.readResult(JSONConnector.java:319)
        at org.ttrssreader.net.JSONConnector.internalLogin(JSONConnector.java:526)
        at org.ttrssreader.net.JSONConnector.sessionNotAlive(JSONConnector.java:451)
        at org.ttrssreader.net.JSONConnector.getHeadlines(JSONConnector.java:978)
        at org.ttrssreader.controllers.Data.cacheArticles(Data.java:168)
        at org.ttrssreader.gui.CategoryActivity$CategoryUpdater.doInBackground(CategoryActivity.java:254)
        at org.ttrssreader.gui.CategoryActivity$CategoryUpdater.doInBackground(CategoryActivity.java:227)
        at org.ttrssreader.utils.AsyncTask$3.call(AsyncTask.java:199)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:923) 

Indeed, after applying this update, TTRSS returns a "config" object in the login message that TTRSS-Reader is not expecting:

# Version: 2adf364c2c
$ curl -X POST https://example.com/ttrss/api/index.php -H "Content-Type: text/json;charset=UTF-8" -d '{"op":"login","user":"debug","password":"mysecretpass"}'
{"seq":0,"status":0,"content":{"session_id":"n7k9z32g5us1980i2kms9284jm","config":{"icons_dir":"feed-icons","icons_url":"feed-icons","daemon_is_running":false,"custom_sort_types":[],"num_feeds":1},"api_level":16}}

# Version: 9f6237a1b8
$ curl -X POST https://example.com/ttrss/api/index.php -H "Content-Type: text/json;charset=UTF-8" -d '{"op":"login","user":"debug","password":"mysecretpass"}'
{"seq":0,"status":0,"content":{"session_id":"fpf54n7k9z38llpr5n5vg4ura3","api_level":16}}

As a workaround, one can keep the server (or go back if accidentaly updated with git checkout) at 9f6237a1b8.

@TwizzyDizzy
Copy link

Just wanted to report this. Can confirm anything above.

Cheers
Thomas

@nilsbraden
Copy link
Owner

Thanks for reporting, wouldn't have noticed it otherwise since I hardly ever think about updating the server at the moment...

I fixed it by parsing the config if it is provided, values are stored in Controller and in case of feed-icons url it is used if it differs from the configured value in the user preferences. In that case the outdated value in the preferences is also updated to avoid trouble later on, I guess if the server provides a value we can savely accept it.

nilsbraden added a commit that referenced this issue May 31, 2021
 * Fix #451: Crash because of changes in server, unexpected config object in login response
 * Fix #450: Crash on initializing OkHttpClient, also removed async behavior on controller init
 * Fix #448: Fix init of DB for new column "score"
@TwizzyDizzy
Copy link

The fix has arrived in F-Droid. Installed it today, updated to HEAD of Tiny Tiny rss and... the app crashed.

That being said: deleting app cache and app data (and re-entering all credentials and stuff) the issue was gone and the app is fully functional again.

Cheers
Thomas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants