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

[bugfix] multiple remotes with single conan upload #7781

Merged

Conversation

kralicky
Copy link
Contributor

@kralicky kralicky commented Sep 30, 2020

Changelog: Bugfix: Fixed bug where uploading to multiple remotes in a single conan upload command would fail.
Docs: omit

Fixes #7780

This bug was due to closing and reusing a thread pool in a loop. Instead, a separate thread pool will be created at each loop iteration.

  • Refer to the issue that supports this Pull Request.
  • If the issue has missing info, explain the purpose/use case/pain/need that covers this Pull Request.
  • I've read the Contributing guide.
  • I've followed the PEP8 style guides for Python code.
  • I've opened another PR in the Conan docs repo to the develop branch, documenting this one.

Note: By default this PR will skip the slower tests and will use a limited set of python versions. Check here how to increase the testing level by writing some tags in the current PR body text.


for remote, refs in refs_by_remote.items():
self._upload_thread_pool = ThreadPool(8 if parallel_upload else 1)
Copy link
Contributor Author

@kralicky kralicky Sep 30, 2020

Choose a reason for hiding this comment

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

Maybe this should use tools.cpu_count()?

Copy link
Member

@memsharded memsharded Sep 30, 2020

Choose a reason for hiding this comment

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

This doesn't look right either, as the self._upload_thread_pool variable will be overwritten, losing access to the other pool from the previous remote.

Copy link
Contributor Author

@kralicky kralicky Sep 30, 2020

Choose a reason for hiding this comment

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

Each iteration of this loop will complete before the next starts, since map() will block, then it will close the thread pool and start the next iteration.

Copy link
Contributor Author

@kralicky kralicky Sep 30, 2020

Choose a reason for hiding this comment

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

Wait, we can definitely reuse the thread pool here. Keeping it alive the whole time makes a lot more sense.

Copy link
Member

@memsharded memsharded left a comment

Thanks for submitting this PR.

I would like to understand better why it is failing in the first case, I cannot see an evident reason, so I'd need to try it a bit first.


for remote, refs in refs_by_remote.items():
self._upload_thread_pool = ThreadPool(8 if parallel_upload else 1)
Copy link
Member

@memsharded memsharded Sep 30, 2020

Choose a reason for hiding this comment

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

This doesn't look right either, as the self._upload_thread_pool variable will be overwritten, losing access to the other pool from the previous remote.

@memsharded memsharded added this to the 1.30 milestone Oct 1, 2020
Copy link
Member

@memsharded memsharded left a comment

Great! Now I understand the issue, it is totally clear.
Thanks very much for contributing this.

@memsharded memsharded merged commit c3c8a79 into conan-io:develop Oct 1, 2020
2 checks passed
@kralicky kralicky deleted the bugfix/multiple-remotes-single-upload branch Oct 1, 2020
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.

[bug] Upload fails with multiple remotes in the same command
2 participants