Skip to content

[bugfix] multiple remotes with single conan upload - #7781

Merged
memsharded merged 4 commits into
conan-io:developfrom
kralicky:bugfix/multiple-remotes-single-upload
Oct 1, 2020
Merged

memsharded merged 4 commits into
conan-io:developfrom
kralicky:bugfix/multiple-remotes-single-upload

Conversation

@kralicky

@kralicky kralicky commented Sep 30, 2020

Copy link
Copy Markdown
Contributor

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.

Comment thread conans/client/cmd/uploader.py Outdated
self._upload_thread_pool = ThreadPool(1)

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

@kralicky kralicky Sep 30, 2020

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Member

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
Copy Markdown
Contributor Author

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
Copy Markdown
Contributor Author

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.

@memsharded memsharded left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Comment thread conans/client/cmd/uploader.py Outdated
self._upload_thread_pool = ThreadPool(1)

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

Copy link
Copy Markdown
Member

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

@memsharded memsharded left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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
@kralicky
kralicky deleted the bugfix/multiple-remotes-single-upload branch October 1, 2020 22:24
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