tmux-plugins / tmux-resurrect

Persists tmux environment across system restarts.
MIT License
11.42k stars 424 forks source link

Restore not loading any names/commands/pane sizes anymore #404

Closed rjorgenson closed 2 years ago

rjorgenson commented 3 years ago

For some reason tmux-resurrect is no longer restoring any session parameters but does restore the correct number of windows/panes. Here is the contents of the tmux-resurrect file (sanitized)

pane    outrider    1   :window1    0   :   1   :/home/robert   0   tail    :tail -f a.log.file.log
pane    outrider    1   :window1    0   :   2   :/home/robert/a/directory   1   zsh :
pane    outrider    1   :window1    0   :   3   :/home/robert   0   zsh :
pane    outrider    2   :window2    1   :*  1   :/home/robert   0   tail    :tail -f a.log.file.log
pane    outrider    2   :window2    1   :*  2   :/home/robert   0   ssh :ssh somehost
pane    outrider    2   :window2    1   :*  3   :/home/robert   0   ssh :ssh somehost
pane    outrider    2   :window2    1   :*  4   :/home/robert   1   ssh :ssh somehost
pane    outrider    2   :window2    1   :*  5   :/home/robert   0   ssh :ssh somehost
pane    outrider    3   :window3    0   :-  1   :/home/robert   0   tail    :tail -f a.log.file.log
pane    outrider    3   :window3    0   :-  2   :/home/robert   1   zsh :
pane    outrider    4   :window4    0   :   1   :/home/robert   0   tail    :tail -f a.log.file.log
pane    outrider    4   :window4    0   :   2   :/home/robert   1   zsh :
pane    outrider    5   :window5    0   :   1   :/home/robert   0   tail    :tail -f a.log.file.log
pane    outrider    5   :window5    0   :   2   :/home/robert   1   zsh :
pane    outrider    6   :window6    0   :   1   :/home/robert   0   tail    :tail -f a.log.file.log
pane    outrider    6   :window6    0   :   2   :/home/robert   1   zsh :
pane    outrider    7   :window7    0   :   1   :/home/robert   0   tail    :tail -f a.log.file.log
pane    outrider    7   :window7    0   :   2   :/home/robert   1   zsh :
pane    outrider    8   :window8    0   :#  1   :/home/robert   0   tail    :tail -f a.log.file.log
pane    outrider    8   :window8    0   :#  2   :/home/robert/another/dir   1   vim :vim foo.bar
window  outrider    1   0   :   f6f2,228x95,0,0[228x23,0,0,1,228x36,0,24,2,228x34,0,61,3]
window  outrider    2   1   :*  b353,228x95,0,0[228x15,0,0,4,228x44,0,16{117x44,0,16,5,110x44,118,16[110x25,118,16,6,110x18,118,42,7]},228x34,0,61,8]
window  outrider    3   0   :-  b28d,228x95,0,0[228x27,0,0,9,228x67,0,28,10]
window  outrider    4   0   :   5713,228x95,0,0[228x44,0,0,11,228x50,0,45,12]
window  outrider    5   0   :   4596,228x95,0,0[228x43,0,0,13,228x51,0,44,14]
window  outrider    6   0   :   4599,228x95,0,0[228x43,0,0,15,228x51,0,44,16]
window  outrider    7   0   :   129c,228x95,0,0[228x39,0,0,17,228x55,0,40,18]
window  outrider    8   0   :#  529a,228x95,0,0[228x39,0,0,19,228x55,0,40,20]
state   outrider

After a restore from the above file this is the resulting resurrect file now

pane    outrider    1   1   :*  1   :/home/robert   0   zsh :
pane    outrider    1   1   :*  2   :/home/robert   0   zsh :
pane    outrider    1   1   :*  3   :/home/robert/  1   zsh :
pane    outrider    2   0   :#  1   :/home/robert   0   zsh :
pane    outrider    2   0   :#  2   :/home/robert   0   zsh :
pane    outrider    2   0   :#  3   :/home/robert   0   zsh :
pane    outrider    2   0   :#  4   :/home/robert   0   zsh :
pane    outrider    2   0   :#  5   :/home/robert   1   zsh :
pane    outrider    3   0   :#  1   :/home/robert   0   zsh :
pane    outrider    3   0   :#  2   :/home/robert   1   zsh :
pane    outrider    4   0   :#  1   :/home/robert   0   zsh :
pane    outrider    4   0   :#  2   :/home/robert   1   zsh :
pane    outrider    5   0   :#  1   :/home/robert   0   zsh :
pane    outrider    5   0   :#  2   :/home/robert   1   zsh :
pane    outrider    6   0   :#  1   :/home/robert   0   zsh :
pane    outrider    6   0   :#  2   :/home/robert   1   zsh :
pane    outrider    7   0   :#  1   :/home/robert   0   zsh :
pane    outrider    7   0   :#  2   :/home/robert   1   zsh :
pane    outrider    8   0   :#  1   :/home/robert   0   zsh :
pane    outrider    8   0   :#  2   :/home/robert   1   zsh :
window  outrider    1   :zsh    1   :*  3733,226x95,0,0[226x25,0,0,1,226x25,0,26,2,226x43,0,52,3]   on
window  outrider    2   :zsh    0   :#  82e0,226x95,0,0[226x16,0,0,4,226x15,0,17,5,226x15,0,33,6,226x15,0,49,7,226x30,0,65,8]   on
window  outrider    3   :zsh    0   :#  9b2d,226x95,0,0[226x37,0,0,9,226x57,0,38,10]    on
window  outrider    4   :zsh    0   :#  76f3,226x95,0,0[226x37,0,0,11,226x57,0,38,12]   on
window  outrider    5   :zsh    0   :#  76f6,226x95,0,0[226x37,0,0,13,226x57,0,38,14]   on
window  outrider    6   :zsh    0   :#  76f9,226x95,0,0[226x37,0,0,15,226x57,0,38,16]   on
window  outrider    7   :zsh    0   :#  76fc,226x95,0,0[226x37,0,0,17,226x57,0,38,18]   on
window  outrider    8   :zsh    0   :#  b6fa,226x95,0,0[226x37,0,0,19,226x57,0,38,20]   on
state   outrider

Did something change? It's been quite some time since I've had to use resurrect. This is happening across a few sessions on different hosts that I have. Is there a way to recover my old resurrect file other than manually?

ulises-castro commented 3 years ago

Yeah, it is happening to me as well, it's a nightmare, because when I restore my session it creates new non-existing panes, and I tried removed manually and it still not working....

normen commented 3 years ago

Ditto

normen commented 3 years ago

Going back to v2.4.0 fixes the issue for me (git checkout tags/v2.4.0 in tmux-resurrect folder). You might have to recover a previous tmux_resurrect_xxxxxx.tmux file and link it to last.

bruno- commented 3 years ago

@normen can you try this:

normen commented 3 years ago

So the tip is to update while tmux is still running, do I get that right?

normen commented 3 years ago

That seemed to have worked but it seems a bit unlucky that 3.0 can't load saves from 2.4 properly?

bruno- commented 3 years ago

So the tip is to update while tmux is still running, do I get that right?

Yep.

That seemed to have worked but it seems a bit unlucky that 3.0 can't load saves from 2.4 properly?

3.0 is a new major version https://semver.org

normen commented 3 years ago

That seemed to have worked but it seems a bit unlucky that 3.0 can't load saves from 2.4 properly?

3.0 is a new major version https://semver.org

Usually incompatibilities of a major version are not a concern on the user side where appropriate importing mechanisms should be implemented. As per the doc you linked the incompatibilities are mainly about API changes, which are not a user concern. So thats only an excuse if you can explain why 3.0 can't load files written with 2.4 - which I suspect you can't 🙂

As you see, many people install this plugin via plugin managers like tpm and now - with about 6 years since the last official release this incompatibility bites people quite unexpectedly.

rjorgenson commented 3 years ago

Reverting to v2.4.0 and restoring then upgrading and saving worked for me as well. Definitely frustrating that this workflow was broken for users but at least I was able to recover.

bruno- commented 3 years ago

I guess we should write an upgrade doc and link to it from the readme. Any volunteers?

normen commented 3 years ago

I suppose the hint would just be "3.0 can not load sessions stored in 2.4, make sure to update while your tmux session is still running and then immediately save a new session with 3.0".

bruno- commented 3 years ago

Any resurrect upgrade should happen with tmux running. That should be the norm.

Then maybe add a special comment about upgrade to 3.0 in the README.

rjorgenson commented 3 years ago

It might be worth including instructions to migrate a 2.4 save to a 3.0 save if someone has already upgraded like we had. Tmux is always running so it was definitely upgraded while running but the upgrade itself didn't trigger a new save and I hadn't made any changes to trigger a save in over 7 days in my session. The restore process was super simple though, this is exactly what I did to recover my save.

  1. Make sure tmux isn't running (#: tmux kill-server)
  2. Check out tag v2.4.0 (#: cd ~/.tmux/resurrect && git checkout v2.4.0)
  3. start tmux and resurrect your session (#: tmux)
  4. checkout master (#: cd ~/.tmux/resurrect && git checkout master)
  5. save your layout (<prefix>-C-s)
studgeek commented 3 years ago

Resurrect should probably save a version number in its save files and check it when restoring. Even if it can't automatically migrate the old data, it should warn the user it can't (with a link to this issue perhaps or docs), then quit.

studgeek commented 3 years ago

I saw something similar even when I saved with 3.0.0 and restored with 3.0. I'm not sure why so have gone back to 2.4.0 for now. If If I later have a chance to reproduce will create new bug on that, but wanted to share in the meantime in case others have seen similar symptom on pure 3.0.0.

studgeek commented 3 years ago

Note, my issue may have been related to being upgraded to tmux 3.2 between save (with 3.0) and restore (also with 3.0). The problem looked similar to above though, windows were all named cat (or on some attempts bash). I also didn't have pane contents. I saw that pane_contents/restore was empty so I unzipped the pane_contents zip into that then tried again. That seemed to at least get window contents, but I still had to manually rename each window. I suggested in #410 that adding some logging would help with issues like these.