ipfs / js-ipfs

IPFS implementation in JavaScript
https://js.ipfs.tech
Other
7.43k stars 1.25k forks source link

[ipfs-core] - Exception is raised when attempting to releaseLock #3520

Closed xmaysonnave closed 1 year ago

xmaysonnave commented 3 years ago

Environment

Severity:

Medium, while debugging Chrome always complain even the 'Pause on caught exceptions' is unchecked

Description:

ipfs-http-client dynamically downloaded from jsdelivr https://cdn.jsdelivr.net/npm/ipfs-http-client@49.0.1/dist/index.min.js

Component

ipfs-core/src/runtime/preload-brower.js

Chrome Developper tools is open. The following exception is triggered in the finally close while attempting to release the reader lock (line 32)

TypeError: This readable stream reader has been released and cannot be used to monitor the stream's state

Thanks

achingbrain commented 3 years ago

Do you have a small example project I can use to reproduce this problem?

xmaysonnave commented 3 years ago

@achingbrain I will be very happy to provide an example however : I dynamically load the library from jsdelivr (sri hash enabled) I noticed that no non minified version is available. https://www.jsdelivr.com/package/npm/ipfs-http-client?path=dist It would be useful to have a non minified version. Maybe if you can build a non minified version on github I will able to load it with a minimal impact on my side. The idea here is to reproduce it on my side and give you something useful. Let me know. Thanks

achingbrain commented 3 years ago

Linking to the minified code in your project is fine, I can always swap it out locally to see if the error still occurs.

xmaysonnave commented 3 years ago

Chrome Version 88.0.4324.150 (Official Build) (64-bit) Debian Bullseye, kernel 5.10.14-xanmod1

https://dweb.link/ipfs/bafybeiguy3u45vc2i5ojlhmqfffpvxpfrcs4nq7ov6ez7kj7vbzmfuvx4m

Load IPFS with TiddlyWiki with the previous link. Open the Developer Tools (ipfs-http-client is not yet loaded). Select Sources and open the console. I usually preserve the console log while saving. The pause on caught exceptions is unchecked.

At the very top:

You are going to save over ipfs.infura.io:5001 and load the new wiki from dweb.link. The console will output a lot of informations.

While saving the exception is raised multiple times.

Thanks

achingbrain commented 3 years ago

Do I need to be authenticated at all? I've followed your instructions but get a 403 when it tries to do an ipfs.files.stat:

image

xmaysonnave commented 3 years ago

This exception is raised and catched as infura do not allow files.stat. The program flow should not be disturbed. No authentication is required. Did you get the exception I detailed? Thanks

On Wed, 24 Feb 2021, 19:49 Alex Potsides, notifications@github.com wrote:

Do I need to be authenticated at all? I've followed your instructions but get a 403 when it tries to do an ipfs.files.stat:

[image: image] https://user-images.githubusercontent.com/665810/109013590-41c75600-76ab-11eb-8132-9db76764a054.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ipfs/js-ipfs/issues/3520#issuecomment-785107683, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE47PBCEX6VYU2W6WP4ZRV3TAUDIBANCNFSM4XAJ2ACA .

achingbrain commented 3 years ago

infura do not allow files.stat.

It looks like the application is invoking this here: https://github.com/xmaysonnave/tiddlywiki-ipfs/blob/73038b5b41d1675848a978207f4b53c3f1c2a316/core/modules/library/ipfs-bundle/ipfs-library.js#L372 called from here: https://github.com/xmaysonnave/tiddlywiki-ipfs/blob/73038b5b41d1675848a978207f4b53c3f1c2a316/core/modules/library/ipfs-bundle.js#L426

You may need to refactor your application to only use APIs that infura allow.

Did you get the exception I detailed?

No, only what I pasted above.

xmaysonnave commented 3 years ago

The exception remains in the latest however with Chrome Developer Tools the 'Pause on Exceptions' should be selected (the 'Pause on caught exception' should be unchecked)

ksnip_20210530-121633

This exception is handled by Chrome though and do not seem to cause any trouble if Pause on Exceptions is unchecked.

Here is an updated link of IPFS with TiddlyWiki https://bafybeicxmapwbfqh6e3z7nyr3turbn4o22mcsxsm3xfhn5nfzoagxcqk6i.ipfs.dweb.link/

Thanks

SgtPooki commented 1 year ago

js-ipfs is being deprecated in favor of Helia. You can https://github.com/ipfs/js-ipfs/issues/4336 and read the migration guide.

Please feel to reopen with any comments by 2023-06-02. We will do a final pass on reopened issues afterward (see https://github.com/ipfs/js-ipfs/issues/4336).

This issue won't be fixed in js-ipfs but there is replacement functionality available in kubo-rpc-client that should work much better.