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]: logger produces duplicates on MacOS #339

Closed
abrichr opened this issue Jul 2, 2023 · 1 comment · Fixed by #366
Closed

[Bug]: logger produces duplicates on MacOS #339

abrichr opened this issue Jul 2, 2023 · 1 comment · Fixed by #366
Labels
bug Something isn't working

Comments

@abrichr
Copy link
Member

abrichr commented Jul 2, 2023

Describe the bug

During recording:

2023-07-02 11:33:00.922 | INFO     | __main__:read_screen_events:402 - starting                                                                                                                                        
2023-07-02 11:33:00.931 | INFO     | __main__:read_window_events:429 - starting                                                                                                                                        
2023-07-02 11:33:00.948 | INFO     | __main__:process_events:132 - starting                                                                                                                                            
2023-07-02 11:33:00.948 | INFO     | __main__:process_events:132 - starting                                
2023-07-02 11:33:01.147 | INFO     | __main__:read_window_events:448 - _window_data={'title': 'Terminal OpenAdapt — tmux — 215×51', 'left': -3, 'top': 38, 'width': 1515, 'height': 930, 'window_id': 204051}          
2023-07-02 11:33:01.147 | INFO     | __main__:read_window_events:448 - _window_data={'title': 'Terminal OpenAdapt — tmux — 215×51', 'left': -3, 'top': 38, 'width': 1515, 'height': 930, 'window_id': 204051}          
2023-07-02 11:33:02.789 | INFO     | __mp_main__:write_events:273 - event_type='screen' starting                                                                                                                       
2023-07-02 11:33:02.808 | INFO     | __mp_main__:write_events:273 - event_type='window' starting   

This does not occur if utils.configure_logging is modified to return immediately.

To Reproduce

python -m openadapt.record foo

@abrichr abrichr added the bug Something isn't working label Jul 2, 2023
@angelala3252
Copy link
Collaborator

This bug occurs on Windows too

nweston added a commit to nweston/OpenAdapt that referenced this issue Jul 8, 2023
Acquire a lock in utils.configure_logging. Otherwise this function has
a race where two threads can both call logger.remove(), and then both
call logger.add(), creating two identical sinks.
nweston added a commit to nweston/OpenAdapt that referenced this issue Jul 9, 2023
Acquire a lock in utils.configure_logging. Otherwise this function has
a race where two threads can both call logger.remove(), and then both
call logger.add(), creating two identical sinks.
nweston added a commit to nweston/OpenAdapt that referenced this issue Jul 11, 2023
abrichr pushed a commit that referenced this issue Jul 17, 2023
* fix(utils): prevent duplicate log messages (#339)

Acquire a lock in utils.configure_logging. Otherwise this function has
a race where two threads can both call logger.remove(), and then both
call logger.add(), creating two identical sinks.

* refactor(record): remove redundant configure_logging calls

configure_logging is already called at the module level so there's no
need to call it with identical arguments in various functions.

* fixup! fix(utils): prevent duplicate log messages (#339)
R-ohit-B-isht pushed a commit to R-ohit-B-isht/OpenAdapt that referenced this issue Jun 21, 2024
…ptAI#366)

* fix(utils): prevent duplicate log messages (OpenAdaptAI#339)

Acquire a lock in utils.configure_logging. Otherwise this function has
a race where two threads can both call logger.remove(), and then both
call logger.add(), creating two identical sinks.

* refactor(record): remove redundant configure_logging calls

configure_logging is already called at the module level so there's no
need to call it with identical arguments in various functions.

* fixup! fix(utils): prevent duplicate log messages (OpenAdaptAI#339)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants