Skip to content

Conversation

nnehdi-zz
Copy link

Fixes #595

harshavardhana
harshavardhana previously approved these changes Feb 20, 2018
Copy link
Member

@harshavardhana harshavardhana left a comment

Choose a reason for hiding this comment

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

LGTM thanks @nnehdi

def __init__(self, num_threads):
self.results_queue = queue()
self.exceptions_queue = queue()
self.tasks_queue = queue(num_threads)
Copy link
Member

Choose a reason for hiding this comment

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

@nnehdi you need to remove queue size restriction here.. otherwise multipart PUT won't work. The reason is that the code in this PR will fill tasks_queue with all tasks before starting to execute them.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I've tested the existing code (without @vadmeste's suggested correction above) and verified that multi-part uploads fails when more than num_threads parts are involved in the multi-part upload. That is, when the tasks-queue size is limited with num_threads, 3 in our case, the multi-part upload hangs with files bigger than 15MB (3 x 5MB - multi-part size limit) since tasks_queue gets full after 3rd part is tasks_queue.put in and the tasks_queue.put action for the 4th part blocks the operation.
So, we should not limit the size of the tasks-queue :
self.tasks_queue = queue(num_threads) => self.tasks_queue = queue()

Copy link
Author

Choose a reason for hiding this comment

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

@ebozduman @vadmeste I agree with you, I did not consider that. As @ebozduman said we should remove the limit of queue size because we put all chunks of a file before we start the Worker threads.
thank you, guys.

Copy link
Member

@vadmeste vadmeste left a comment

Choose a reason for hiding this comment

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

Thanks for this PR @nnehdi , one important comment needs to be addressed

self.results_queue = results_queue
self.exceptions_queue = exceptions_queue
self.daemon = True
self.daemon = False
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we turn off daemon mode, self.daemon = False ?

Copy link
Author

Choose a reason for hiding this comment

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

It depends on your situation. In our use case, we want to close the thread immediately after the program stopped and it's not important for us to miss an uploading file. I change this flag to its previous value (True) but It's better to have a config that user can change this flag depends on their situation when using py-mino.
tnx

Copy link
Collaborator

@ebozduman ebozduman Feb 23, 2018

Choose a reason for hiding this comment

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

@nnehdi,
Thank you very much for working on this fix.
Are you going to push these review comment changes, so that we can merge and close the PR?

Change Worker daemon field to True.
remove queue self.task_queue size restriction in ThreadPool class.

Fixes minio#595
if not self.exceptions_queue.empty():
raise self.exceptions_queue.get()


Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you also clean up these last 2 extra lines introduced?

if not self.exceptions_queue.empty():
raise self.exceptions_queue.get()


Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you also clean up these last 2 extra space lines introduced?

def run(self):
fast_quit = False
while True:

Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't need this extra line.

""" Return the result of all called tasks """
return self.results_queue


Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't need this extra line.
Could you also squash when you are done.

Copy link
Member

@harshavardhana harshavardhana left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@vadmeste vadmeste left a comment

Choose a reason for hiding this comment

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

LGTM & tested

@nitisht nitisht merged commit 7f32d7d into minio:master Mar 7, 2018
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.

6 participants