Investigate Why Emacs Hangs Sometimes
Fleetinginvestigate why emacs hangs sometimes
# Agent Shell Transcript
**Agent:** Claude Code
**Started:** 2026-03-05 11:23:44
**Working Directory:** /home/sam/
---
## User (2026-03-05 11:23:44)
emacs running at pid 1244789 is stuck at quitting, can we investigate?
## Agent's Thoughts (2026-03-05 11:23:47)
Let me investigate the stuck Emacs process.
### Tool Call [completed]:
**Timestamp:** 2026-03-05 11:24:23
````
```console
1244789 D fuse_l /home/sam/.nix-profile/bin/emacs --no-site-file --no-splash --debug-init --eval (konix/start-calendar)
```
````
### Tool Call [completed]:
**Timestamp:** 2026-03-05 11:24:24
````
```console
13
Name: emacs
Umask: 0002
State: D (disk sleep)
Tgid: 1244789
Ngid: 0
Pid: 1244789
PPid: 1244784
TracerPid: 0
Uid: 1000 1000 1000 1000
Gid: 1000 1000 1000 1000
FDSize: 256
Groups: 5 24 25 27 29 30 44 46 100 106 110 996 1000 1001
NStgid: 1244789
NSpid: 1244789
NSpgid: 1244789
NSsid: 1240350
Kthread: 0
VmPeak: 250500 kB
VmSize: 250500 kB
VmLck: 0 kB
```
````
### Tool Call [completed]:
**Timestamp:** 2026-03-05 11:24:25
````
```console
fuse_lock_inode
cat: /proc/1244789/stack: Permission denied
```
````
## Agent (2026-03-05 11:24:26)
The process is in **D state (uninterruptible disk sleep)** blocked on `fuse_lock_inode` — it's stuck waiting on a FUSE filesystem operation.
Let me check what FUSE mounts are involved.
### Tool Call [completed]:
**Timestamp:** 2026-03-05 11:24:42
````
```console
42 25 0:33 / /sys/fs/fuse/connections rw,nosuid,nodev,noexec,relatime shared:18 - fusectl fusectl rw
446 31 0:72 / /mfs rw,nosuid,nodev,relatime shared:388 - fuse /dev/fuse rw,user_id=1000,group_id=1000
456 31 0:73 / /ipfs rw,nosuid,nodev,relatime shared:396 - fuse /dev/fuse rw,user_id=1000,group_id=1000
465 31 0:74 / /ipns rw,nosuid,nodev,relatime shared:404 - fuse /dev/fuse rw,user_id=1000,group_id=1000
```
````
### Tool Call [completed]:
**Timestamp:** 2026-03-05 11:24:46
````
```console
total 0
lrwx------ 1 sam sam 64 Mar 5 09:56 0 -> /dev/pts/13
lrwx------ 1 sam sam 64 Mar 5 09:56 1 -> /dev/pts/13
l-wx------ 1 sam sam 64 Mar 5 09:56 10 -> pipe:[1754906]
lr-x------ 1 sam sam 64 Mar 5 09:56 11 -> anon_inode:inotify
lrwx------ 1 sam sam 64 Mar 5 09:56 12 -> /home/sam/.emacs.d/org-roam.db
lrwx------ 1 sam sam 64 Mar 5 09:56 2 -> /dev/pts/13
lrwx------ 1 sam sam 64 Mar 5 09:56 3 -> anon_inode:[timerfd]
lrwx------ 1 sam sam 64 Mar 5 09:56 4 -> /dev/tty
lrwx------ 1 sam sam 64 Mar 5 09:56 5 -> socket:[1756000]
lrwx------ 1 sam sam 64 Mar 5 09:56 6 -> /dev/ptmx
lrwx------ 1 sam sam 64 Mar 5 09:56 7 -> anon_inode:[eventfd]
lrwx------ 1 sam sam 64 Mar 5 09:56 8 -> socket:[1756002]
lr-x------ 1 sam sam 64 Mar 5 09:56 9 -> pipe:[1754906]
```
````
### Tool Call [completed]:
**Timestamp:** 2026-03-05 11:24:47
````
```console
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
/dev/fuse on /mfs type fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
/dev/fuse on /ipfs type fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
/dev/fuse on /ipns type fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
```
````
### Tool Call [completed]:
**Timestamp:** 2026-03-05 11:24:53
````
```console
72
73
74
```
````
### Tool Call [completed]:
**Timestamp:** 2026-03-05 11:24:55
````
```console
=== /sys/fs/fuse/connections/72/ ===
0
=== /sys/fs/fuse/connections/73/ ===
1
=== /sys/fs/fuse/connections/74/ ===
0
```
````
### Tool Call [completed]: ps aux | grep -E 'ipfs|mfs|fuse' | grep -v grep
**Tool:** execute
**Timestamp:** 2026-03-05 11:24:55
**Description:** Check if FUSE daemon processes are running
**Command:** ps aux | grep -E 'ipfs|mfs|fuse' | grep -v grep
````
```console
sam 13403 0.3 1.5 2773084 123660 ? Ssl 07:01 0:51 ipfs daemon --migrate=true --enable-pubsub-experiment --mount
```
````
## Agent (2026-03-05 11:24:56)
Here's the picture:
**Root cause**: Emacs is stuck in D-state (uninterruptible sleep) on `fuse_lock_inode`, blocked on FUSE connection **73** (`/ipfs`), which has **1 waiting request** that the IPFS daemon isn't responding to.
The IPFS daemon (PID 13403) is running with `--mount`, serving `/ipfs` and `/ipns`. Emacs likely tried to access something on `/ipfs` during quit (e.g., a buffer visiting a file there, or a recent-files/recentf check) and the IPFS daemon isn't completing the request.
**Options to unblock it:**
1. **Restart the IPFS daemon** — this may unblock the FUSE request:
```
kill -HUP 13403
```
2. **Abort the stuck FUSE connection** (more forceful) — this will abort all pending requests on `/ipfs`:
```
echo 1 > /sys/fs/fuse/connections/73/abort
```
This should release Emacs from the D-state immediately, though it will also break the `/ipfs` mount (you'd need to remount via `ipfs mount` or restart the daemon).
3. **`kill -9` won't work** on a process in D-state — it can only be killed once the kernel call returns.
Option 2 is the most reliable way to free Emacs. Want me to abort the FUSE connection?