Skip to content

NotepadNext Fails to Handle Stale Lock Files from Unclean Shutdowns #765

Open
@Kreijstal

Description

@Kreijstal

Operating System and Version

archlinux, master branch

Distribution

qmake6 src/NotepadNext.pro

Description

after fixing #752 by hand, NotepadNext, utilizing the SingleApplication library, does not properly handle stale lock files left behind after an unclean shutdown (e.g., via Ctrl+C or crash). This results in subsequent launches incorrectly detecting a "primary instance already running," preventing the application from starting until lock files are manually removed.

Steps to Reproduce

  1. Launch NotepadNext from a terminal (./NotepadNext).
  2. Close the application uncleanly, e.g., by pressing Ctrl+C in the terminal or simulating a crash (e.g., kill -9 ).
  3. Attempt to launch NotepadNext again.
  4. Observe the error log:
[ 1.106] I: Primary instance already running. PID: <previous_pid>
[ 1.211] W: sendMessage() unsuccessful
  1. The secondary instance exits without starting the application.

Manually remove lock files:

sudo rm /dev/shm/NQd7ehOB89VHFdGSy2fPICYNWen1ylD7GZQtd_a754Q=
sudo rm /tmp/NQd7ehOB89VHFdGSy2fPICYNWen1ylD7GZQtd_a754Q=

Relaunch NotepadNext, which now starts successfully as the primary instance.

Debug Information

Notepad Next v0.11 
Build Date/Time: May 11 2025 11:31:32
Qt: 6.9.0
OS: Arch Linux
Locale: en_US
CPU: x86_64
File Path: /usr/bin/NotepadNext
Arguments: NotepadNext
Config File: /home/kreijstal/.config/NotepadNext/NotepadNext.ini

Additional Details

e.g. screenshots, logs, etc

Metadata

Metadata

Assignees

No one assigned

    Labels

    dependenciesPull requests that update a dependency filelinuxRelated specifically to Linux-based OSs

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions