I experienced a failure in the issue tracker when trying to submit a comment in a issue thread 5 weeks ago and a week ago under what I think were similar conditions.
I have not tried to replicate further as it is not something that I expect will commonly happen and may even be hard to replicate for an active user.
I will link too an older issue here that MIGHT have something in common but I have no real experience as I am not an active coder or issue tracker user here or elsewhere.
This issue mentions preview and secrets so perhaps it may provide insight into the old problem or my experience.
My problem showed up twice in the following way. I type a long formatted reply in an issue and want to preview it to see that the formatting tags are correctly closed and working as expected. I receive some error and my submission is GONE and I see no way to retrieve it. Going back a page leave the issue in question and going forward has no edits.
What I think caused the issue is that the issue tracker page had been left open for a long duration of many days, perhaps more than a week (while I was debugging the application slowly) and had been through more than one Firefox restart and Linux Mint reboot in the time. I am assuming that some session cookies had expired and had I been omniscient or at least precognitive I would have known to reload the page before starting to edit so that pressing the preview button would not have caused the catastrophe. When drafting my new reply I prophylactically saved a copy of the markup text before selecting preview in case it would fail again but it has always worked if the issue has been recently refreshed. Granted that the issue in question had an interim submission the first time it failed and a title edit the second time it failed so that MIGHT have made the issue worse but I do not know.
Thank you for maintaining a great source repository and I hope my problem does not have far reaching harms. It seems unlikely to affect a regular user who replies to issues in the same session that they opened the thread as I have only had it happen on those two occasions.
EDIT:
As requested my best guess for how the problem appears.
- Open issue on issue tracking page in new tab
- Close browser
- reboot linux
- open browser
- Add reply comment
- Press Preview button
- Some strange error appears that made me think of sessions, cookies or permissions but not something I have seen before
- I think it was still in the Write tab but the tab was empty.
- Back button returned to previous page
- Forward button returns but edit tab is EMPTY
- New edit works as expected
Points 3 and/or 4 may have been repeated many times with the issues tab left open but not reloaded.
Further EDIT:
I tried to see if it would reproduce in this issue section after one browser close and one reboot and at least part of the problem reoccurred with an error message, possibly the same one that panicked me.
- After I edited this message yesterday.
- I Closed browser
- I closed laptop (I think it hibernated, login screen was activated)
- I logged in
- The browser was still open on this tab
- I started a new comment
- I pressed the Preview button and received the following error
Bad Request: invalid CSRF token
- The preview was blank
- Pressing Write brought back my text (Yay)
- Pressing reload page preserved my text (Yay)
- Pressing Preview STILL showed a BLANK preview but no error
- Pressing Write returned to my text
- Editing a few characters and pressing Preview displayed the correct preview
It seems that had I not panicked and pressed Page Back on the error screen it might have preserved my text on returning to the Write tab and a Page Reload might have reset the CSRF token and allowed me to preserve my edit. I hope this is reproducible.
I am using recent install of Linux Mint, with a recent version of Firefox.
Mozilla Firefox for Linux Mint
mint-001 - 1.0
Updates disabled by your system administrator
123.0.1 (64-bit)
System:
Kernel: 5.15.0-105-generic x86_64 bits: 64 compiler: gcc v: 11.4.0 Desktop: Xfce 4.18.1
tk: Gtk 3.24.33 info: xfce4-panel wm: xfwm 4.18.0 vt: 7 dm: LightDM 1.30.0
Distro: Linux Mint 21.3 Virginia base: Ubuntu 22.04 jammy
I experienced a failure in the issue tracker when trying to submit a comment in a issue thread 5 weeks ago and a week ago under what I think were similar conditions.
I have not tried to replicate further as it is not something that I expect will commonly happen and may even be hard to replicate for an active user.
I will link too an older issue here that MIGHT have something in common but I have no real experience as I am not an active coder or issue tracker user here or elsewhere.
This issue mentions [preview and secrets](https://codeberg.org/forgejo/docs/pulls/5) so perhaps it may provide insight into the old problem or my experience.
My problem showed up **twice** in the following way. I type a long formatted reply in an issue and want to **preview** it to see that the formatting tags are correctly closed and working as expected. I receive some error and my submission is GONE and I see no way to retrieve it. Going back a page leave the issue in question and going forward has no edits.
What I think caused the issue is that the issue tracker page had been left open for a **long duration** of many days, perhaps more than a week (while I was debugging the application slowly) and had been through more than one Firefox restart and Linux Mint reboot in the time. I am assuming that some session cookies had expired and had I been omniscient or at least precognitive I would have known to reload the page before starting to edit so that pressing the preview button would not have caused the catastrophe. When drafting my new reply I prophylactically saved a copy of the markup text before selecting preview in case it would fail again but it has always worked if the issue has been recently refreshed. Granted that the issue in question had an **interim submission** the first time it failed and a **title edit** the second time it failed so that MIGHT have made the issue worse but I do not know.
Thank you for maintaining a great source repository and I hope my problem does not have far reaching harms. It seems unlikely to affect a regular user who replies to issues in the same session that they opened the thread as I have only had it happen on those two occasions.
**EDIT:**
As requested my best guess for how the problem appears.
1. Open issue on issue tracking page in new tab
2. Close browser
3. reboot linux
4. open browser
5. Add reply comment
6. Press **Preview** button
7. Some strange **error** appears that made me think of sessions, cookies or permissions but not something I have seen before
8. I think it was still in the **Write** tab but the tab was empty.
9. Back button returned to previous page
10. Forward button returns but edit tab is EMPTY
11. New edit works as expected
Points 3 and/or 4 may have been repeated many times with the issues tab left open but not reloaded.
**Further EDIT:**
I tried to see if it would reproduce in this issue section after one browser close and one reboot and at least part of the problem reoccurred with an error message, possibly the same one that panicked me.
1. After I edited this message yesterday.
2. I Closed browser
3. I closed laptop (I think it hibernated, login screen was activated)
4. I logged in
5. The browser was still open on this tab
6. I started a new comment
7. I pressed the **Preview** button and received the following **error** `Bad Request: invalid CSRF token`
8. The preview was blank
9. Pressing **Write** brought back my text (Yay)
10. Pressing **reload** page preserved my text (Yay)
11. Pressing **Preview** STILL showed a BLANK preview but no **error**
12. Pressing **Write** returned to my text
13. Editing a few characters and pressing **Preview** displayed the correct preview
It seems that had I not panicked and pressed **Page Back** on the error screen it might have preserved my text on returning to the Write tab and a Page Reload might have reset the **CSRF token** and allowed me to preserve my edit. I hope this is reproducible.
I am using recent install of Linux Mint, with a recent version of Firefox.
```
Mozilla Firefox for Linux Mint
mint-001 - 1.0
Updates disabled by your system administrator
123.0.1 (64-bit)
```
```
System:
Kernel: 5.15.0-105-generic x86_64 bits: 64 compiler: gcc v: 11.4.0 Desktop: Xfce 4.18.1
tk: Gtk 3.24.33 info: xfce4-panel wm: xfwm 4.18.0 vt: 7 dm: LightDM 1.30.0
Distro: Linux Mint 21.3 Virginia base: Ubuntu 22.04 jammy
```