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

ipfs: Remove concurrency limit, rely on rate limit #4570

Merged
merged 3 commits into from
Apr 26, 2023

Conversation

leoyvens
Copy link
Collaborator

@leoyvens leoyvens commented Apr 24, 2023

The concurrency limit, because it uses a semaphore, had unfortunate interactions with the use of call_all in the polling monitor. CallAll can internally have requests which are holding the semaphore, so it must be polled regularly to check on those requests. If the task holding the CallAll hangs on some other future, that can lead to a deadlock.

In our case, it can hang in the response_sender.send((id, response)).await, if the channel is full and the subgraph runner takes a long time to check it:

let send_result = response_sender.send((id, response)).await;

This could be fixed, but the footgun would remain so it seemed best to rely only on the rate limit which can't deadlock.

This also adds a log when a file is not found.

The concurrency limit, because it uses a semaphore, had unfortunate
interactions with the use of `call_all` in the polling monitor.
`CallAll` can internally have requests which are holding the semaphore,
so it must be polled regularly to check on those requests.
If the task holding the `CallAll` hangs on some other future, that
can lead to a deadlock.

In our case, it can hang in the `response_sender.send((id, response)).await`,
if the channel is full and the subgraph runner takes a long time to check it.
This could be fixed, but the footgun would remain so it seemed best to
rely only on the rate limit which can't deadlock.
- `GRAPH_IPFS_REQUEST_LIMIT`: Limits both concurrent and per second requests to IPFS for file data
sources. Defaults to 100.
- `GRAPH_IPFS_REQUEST_LIMIT`: Limits both per second requests to IPFS for file data sources.
Defaults to 100.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better: 'Limits the number of requests per second to IPFS for ...'

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@leoyvens leoyvens merged commit 357517f into master Apr 26, 2023
@leoyvens leoyvens deleted the leo/remove-polling-monitor-concurrency-limit branch April 26, 2023 14:29
leoyvens added a commit that referenced this pull request May 26, 2023
This addresses both sides of the issue, by making sure the task
holding the `CallAll` doesn't hang, and by removing the concurrency
control done by `Buffer`, which may be the reason why PR #4570 didn't
fully work.
leoyvens added a commit that referenced this pull request May 26, 2023
This addresses both sides of the issue, by making sure the task
holding the `CallAll` doesn't hang, and by removing the concurrency
control done by `Buffer`, which may be the reason why PR #4570 didn't
fully work.
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

Successfully merging this pull request may close these issues.

2 participants