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

[BUG] Error delete storage file while the file is still opening and code blocking when put message into a full memory storage queue #1411

Closed
YuanqZh opened this issue May 28, 2024 · 1 comment
Assignees
Labels
bug can be closed If bug fixed or feature is implemented

Comments

@YuanqZh
Copy link

YuanqZh commented May 28, 2024

Describe the bug
1、Error delete storage file while the file is still opening:
20240528152042
Error traceback (If available):

2024-05-28 15:39:43 - |ERROR| - [event_storage_reader.py] - event_storage_reader - delete_read_file - 174 - [WinError 32] The process cannot access the file because it is being used by another process.: './data/data_1716880902430.txt'
Traceback (most recent call last):
  File "E:\Code\Python\tb-gateway-env\Lib\site-packages\thingsboard_gateway-3.5-py3.11.egg\thingsboard_gateway\storage\file\event_storage_reader.py", line 169, in delete_read_file
    remove(self.settings.get_data_folder_path() + current_file.file)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process.: './data/data_1716880902430.txt'

2、when the memory storage is full and put message into queue would couse blocking, I think self.__events_queue.put(event,block=False) would be better

    def put(self, event):
        success = False
        if not self.__stopped:
            try:
                self.__events_queue.put(event)
                success = True
            except Full:
                log.error("Memory storage is full!")
        else:
            log.error("Storage is stopped!")
        return success

Versions (please complete the following information):

  • OS: windows 11
  • Thingsboard IoT Gateway version 3.5
  • Python version 3.11
@YuanqZh YuanqZh added the bug label May 28, 2024
@YuanqZh YuanqZh changed the title [BUG] Two bugs in files storage and memory storage [BUG] Error delete storage file while the file is still opening and code blocking when put message into a full memory storage queue May 28, 2024
imbeacon added a commit that referenced this issue May 30, 2024
@imbeacon
Copy link
Member

Hi @YuanqZh,

Thank you for your participating in project life, you are right, I have added changes, you may find them in the master branch.

@imbeacon imbeacon added the can be closed If bug fixed or feature is implemented label May 30, 2024
@YuanqZh YuanqZh closed this as completed May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug can be closed If bug fixed or feature is implemented
Projects
None yet
Development

No branches or pull requests

3 participants