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

Garbage collection error: Unexpected data after root element - follow up to #13554 #14355

Closed
stephendonner opened this issue Feb 25, 2021 · 7 comments · Fixed by brave/brave-core#8200

Comments

@stephendonner
Copy link

stephendonner commented Feb 25, 2021

Description

Found while testing #13554.

Performing a garbage-collection sweep via the button on brave://ipfs throws "Garbage collection error: Line: 2, column: 1, Unexpected data after root element."

Steps to Reproduce

  1. new profile, launch Brave nightly
  2. load brave://ipfs
  3. click Install and start
  4. wait for the daemon/node to start
  5. now click Perform a garbage collection sweep

Actual result:

Throws "Garbage collection error: Line: 2, column: 1, Unexpected data after root element" error

garbage-error

Expected result:

Reproduces how often:

Brave version (brave://version info)

Brave 1.23.2 Chromium: 89.0.4389.58 (Official Build) nightly (x86_64)
Revision 1a139f28ecc27719439e37c6b1533cee999cb802-refs/branch-heads/4389@{#1134}

Version/Channel Information:

  • Can you reproduce this issue with the current release? no
  • Can you reproduce this issue with the beta channel? no
  • Can you reproduce this issue with the nightly channel? yes

cc: @bbondy @spylogsster

@stephendonner
Copy link
Author

stephendonner commented Mar 9, 2021

@spylogsster @bbondy given this error blocks the feature (and us, from testing) in #13554, should we take a look at this soon-ish? Thanks!

@spylogsster spylogsster self-assigned this Mar 9, 2021
@brave brave locked and limited conversation to collaborators Mar 9, 2021
@brave brave unlocked this conversation Mar 9, 2021
@spylogsster
Copy link

spylogsster commented Mar 9, 2021

@lidel we got wrong formatted json from ipfs node like:

{"Key":{"/":"QmXt3rz4ykJvhJgwfNxYFVLMwAytfjmbjvPUNShaxJYPBQ"}}
{"Key":{"/":"bafkreibj4y5wretuqo5lhwxpojhorky7bcy774zpaewwxvg2xh6yhjuzqe"}}
{"Key":{"/":"Qmb1mDMEz9GTR7nMG7LUQYkZo5W8hfFJ85L1cGFhtmBe74"}}
{"Key":{"/":"QmPm9DAhdu5WM9TpjvKGDA7NPqzidWU39Zcn45YhpSqyVk"}}
{"Key":{"/":"bafkreihfciluj2fegbev7r6avpcmz65s74665gxme7x6h2sitbwcujcyy4"}}
{"Key":{"/":"QmauAa72b712PvGGBAnsYB8vhq2UHKFrqWJpDz8cfG1HZ8"}}
{"Key":{"/":"bafkreicnz3clraadqv3pw232khlwq32ae6ih5ir7b5xyvdblrxcnhxjurm"}}
{"Key":{"/":"QmSUv7Qd5x17etRS77mwKC1USTAYZ4Ch5n98J4ZY6s62gL"}}
{"Key":{"/":"bafkreibgppv54cvn4fg6yhzdqkmxtkst6nhqzvoitkdhjq4ufli6admpmq"}}

@LaurenWags
Copy link
Member

@brave/legacy_qa when retesting this the steps from #13554 (comment) can also be used. However, per @spylogsster in #13554 (comment) we should visit additional sites to increase storage usage prior to running garbage collection.

@LaurenWags LaurenWags changed the title Garbage collection error: Unexpected data after root element Garbage collection error: Unexpected data after root element - follow up to #13554 Mar 9, 2021
@lidel
Copy link

lidel commented Mar 9, 2021

One can browse ipns://en.wikipedia-on-ipfs.org – it has some images which will increase storage.

@spylogsster I believe the streaming response is valid (we use newline-delimited JSON (NDJSON) notation), it is our docs at https://docs.ipfs.io/reference/http/api/#api-v0-repo-gc that need to be improved to indicate streaming response is the default.

So... either you buffer entire response in memory and put it in array [ + + ] or need to implement NDJSON support for parsing streaming response.

@GeetaSarvadnya
Copy link

GeetaSarvadnya commented Mar 10, 2021

Reproduced the issue in Windows 10 x64:


Brave | 1.22.56 Chromium: 89.0.4389.72 (Official Build) dev (64-bit)
-- | --
Revision | 3f345f156bfd157bd1bea06310e55f3fb2490359-refs/branch-heads/4389@{#1393}
OS | Windows 10 OS Version 2004 (Build 19041.804)


image

@spylogsster
Copy link

as discussed with @lidel the response code is enough for us and we should not alert about json parsing errors, added PR about it

@stephendonner
Copy link
Author

stephendonner commented Mar 12, 2021

Verified PASSED using

Brave 1.23.33 Chromium: 89.0.4389.86 (Official Build) nightly (x86_64)
Revision 0c2dac31bc21e806a791641316e99920f84ea52c-refs/branch-heads/4389@{#1472}
OS macOS Version 11.2.3 (Build 20D91)

Steps to verify:

  1. Clean profile with 1.23.33
  2. Visit an ipfs:// URL such as ipfs://bafybeiemxf5abjwjbikoz4mc3a3dla6ual3jsgpdr4cjr3oz3evfyavhwq/wiki/Vincent_van_Gogh.html
  3. Click around a bunch on ipns://en.wikipedia-on-ipfs.org/wiki/ - I garnered over 2000 objects
  4. Open a new tab and visit brave://ipfs - see info in Repo Stats populated

Verified:

  • Upon clicking Perform a garbage collection that the # of objects went down to 13, and Size went to 558129, from originally Objects: 2048 and Size: 24673336
  • There were no garbage-collection error messages
Before garbage collection After garbage collection
Screen Shot 2021-03-11 at 5 41 39 PM Screen Shot 2021-03-11 at 5 42 17 PM

garbage-collection


Verification passed on


Brave | 1.23.52 Chromium: 89.0.4389.105 (Official Build) dev (64-bit)
-- | --
Revision | 14f44e21a9d539cd49c72468a29bfca4fa43f710-refs/branch-heads/4389_90@{#7}
OS | Windows 10 OS Version 2004 (Build 19041.867)

Verified:

  • Upon clicking Perform a garbage collection that the # of objects went down to 13, and Size went to 81963, from originally Objects: 399 and Size: 3820154
  • There were no garbage-collection error messages
Before garbage collection After garbage collection
image image

Verified passed with

Brave	1.23.64 Chromium: 89.0.4389.114 (Official Build) beta (64-bit)
Revision	1ea76e193b4fadb723bfea2a19a66c93a1bc0ca6-refs/branch-heads/4389@{#1616}
OS	Linux

Verified:

  • Upon clicking Perform a garbage collection that the # of objects and size decreased as seen below
  • There were no garbage-collection error messages
Before After
before after

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment