Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

IPFS pubsub stops working after a while #4234

Closed
pleerock opened this issue Oct 16, 2022 · 7 comments
Closed

IPFS pubsub stops working after a while #4234

pleerock opened this issue Oct 16, 2022 · 7 comments
Assignees
Labels
need/triage Needs initial labeling and prioritization

Comments

@pleerock
Copy link

  • Version:
"ipfs-core": "^0.16.1"
  • Platform:

I test this issue on both Apple Intel and Apple M1.
Also issue was reproduced in both node.js and browser.

Severity:

High

Description:

After x number of messages sent (I'm talking about publishing to the topics) pubsub stops receiving messages COMPLETELY.

The only thing that help is repo directory removal. In case of the browsers the only thing helps is clearing browser storage.

Steps to reproduce the error:

I've published a reproduction repo here.

@pleerock pleerock added the need/triage Needs initial labeling and prioritization label Oct 16, 2022
@pleerock
Copy link
Author

Ohhh after two days of research I was able to find a place where the problem might be.

So, if we reset a datastore in libp2p options, everything seem to work:

    const ipfsd = await create({
        repo: "./ipfs-user-2",
        libp2p: (options) => {
            return createLibp2p({
                ...options.libp2pOptions,
                datastore: null
            })
        },

However at this point I have no idea what datastore is for and what this change will affect. Need your help here.

@tabcat
Copy link
Contributor

tabcat commented Nov 3, 2022

Seeing similar issue in node with ipfs-core version 0.17

gist: https://gist.github.com/tabcat/8fc26a03a58617ebea0e8ff4d261fcb3

Behavior seen:

when starting ipfs with an existing repo, peers do not become pubsub peers.

first time running, before repo exists and is then created, everything works great.
second time running, using existing repo, the two nodes do not become pubsub peers.

@tabcat
Copy link
Contributor

tabcat commented Nov 3, 2022

This issue may be a duplicate of #4212

@marcus-pousette
Copy link

marcus-pousette commented Nov 26, 2022

I think it is the same issue as #4212 I wrote a solution there that fixed (I think) the issue for me

@marcus-pousette
Copy link

marcus-pousette commented Nov 27, 2022

Another reason for this problem is that you are running into limits with how many WebSockets connections you have in the browser, which is fairly limited. Each topic is basically its own connection.

Long shot but, if you get MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message lis teners added. Use emitter.setMaxListeners() to increase limit you might run into problems. The default limit for Event Emitter is 10. You can increase it with the emitter.setMaxListeners. Try like emitter.setMaxListeners(100). See this

Lastly, try to make you IPFS config as minimal as possible and only connect to what you need to connect to, to prevent overhead in networking

@shatilov-diman
Copy link

The issue maybe linked to libp2p #1504 which has been fixed at v0.41.0.
Currently ipfs-core released with v0.40.0
Hope it will come soon

@achingbrain
Copy link
Member

achingbrain commented May 22, 2023

js-IPFS is in the process of being deprecated, the replacement is Helia - please see the State of IPFS in JS post for a bit of background and the migration guide for how to port your app over.

Helia incorporates the latest libp2p stack so please try it out and open an issue there or https://github.com/ChainSafe/js-libp2p-gossipsub if the problem persists.

@github-project-automation github-project-automation bot moved this from 🥞 Todo to ✅ Done in js-ipfs deprecation May 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need/triage Needs initial labeling and prioritization
Projects
No open projects
Status: Done
Development

No branches or pull requests

5 participants