{"repo":"mr-vaibh/park","free":true,"listed":false,"github":"https://github.com/mr-vaibh/park","clone":"git clone https://github.com/mr-vaibh/park.git","description":"Pause a process and free its TCP port. Resume later, same PID and memory intact. Ctrl+Z for servers.","language":"Go","stars":20,"topics":["command-line-tool","golang","cli","developer-tools","linux","mach","macos","port","productivity","ptrace"],"license":"MIT","category":"cli-tools","readme_excerpt":"park Pause a process AND release its TCP port. Resume both later, picking up exactly where you left off. Think Ctrl+Z for servers — but unlike Ctrl+Z , the port actually frees so other things can use it while the process is parked. The problem You're running npm run dev on :3000 . You need :3000 for thirty seconds to test something else. Today, your only option is to kill the dev server, losing its in-memory state, build watcher cache, websocket clients, and warm-up time. When you bring it back, everything has to rebuild. park lets you do this instead: Same PID. Same memory. Same open files. Same websocket clients (well, the ones that didn't time out). The dev server has no idea anything happened. How it works The trick is ptrace + syscall injection . Park does not modify, recompile, restart, LD PRELOAD , or instrument the target process in any way. It works on npm run dev , python manage.py runserver , cargo run , a random Java binary, anything. When you run park 3000 : 1. Find the PID listening on :3000 by reading /proc/net/tcp and walking /proc/ /fd/ for the matching socket inode. 2. PTRACE ATTACH to the process and snapshot its registers. 3. Find a few bytes of executable scratch space (the [vdso] page is always mapped and convenient), save the original bytes, and overwrite with the x86 64 sequence 0F 05 CC — that's syscall; int3 . 4. Set RAX=3 (close), RDI= , RIP= , then PTRACE CONT . The target executes one syscall and immediately traps on the int3 . The kernel removes ","default_branch":null,"files":null,"tree":[],"storefront":"/r/mr-vaibh","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/mr-vaibh/park/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}