PYTHON DROPBOX API process been hang since CLOSE_WAIT socket is not closed

32 Views Asked by At

So I have my application running on windows for 5 years now. I have around 800 processes running in 5 different Machines. 5 / day lately are hanging on this: enter image description here

I also managed to find the socket pid and kill it, than the app closed properly. enter image description here

My code is the same regarding dropbox ...was not changed.

mt code flow:

self.uploading_thread = None
...
if self.uploading_thread:
    self.uploading_thread.join()  # wait if last one did not finish
self.uploading_thread = threading.Thread(target=self.update_server_data)
self.uploading_thread.start()

    def update_server_data(self):
        status = 'xsaxasxsa'
        self.statistics_server_o.set_data(status)

    def set_data(self, data):
        self.lock.acquire()
        self.data = data
        self.lock.release()

        # notify thread on new data
        self.new_data_flag.set()

    def update_server(self):
        while self.new_data_flag.wait():

            # clear flag
            self.new_data_flag.clear()

            if self.stop_event:
                break

            local_data_copy = self.get_hard_copy_data()

            # update new data
            try:
                self.dropbox_o.upload_bytes(local_data_copy, '', 'status', '{}_status.txt'.format(self.account_name),
                                            overwrite=True)
            except:
                pass

I can call the update thread many times, it async, so I wait until last job finish before I trigger a new one.

can you see anything related to my code ? should I add termination of the tread with timer ?

0

There are 0 best solutions below