larkery / zsh-histdb

A slightly better history for zsh
MIT License
1.25k stars 74 forks source link

Race condition with tmux synchronised panes #103

Open ScrumpyJack opened 3 years ago

ScrumpyJack commented 3 years ago

With several synchronised panes open in tmux, while typing a command, there's a race to write to the db.

One pane will be successful, then each other pane might error with "Error: near line #some_line_number: database is locked" pane number -1 times. So the forth pane will sometimes error up to three times, (in not particular order).

As the command executed in each pane, by nature, is the same (panes are sync'ed), it would be awesome if there was a way to detect that and have only one pane write to the db.

tmux doesn't set an explicit enough environment to be able to detect this, so I'm at a loss as to how this could be addressed.

ScrumpyJack commented 3 years ago

Just found #27