Troubleshooting
Common issues and their solutions.
Table of Contents
- Attachment Issues
- Error: Operation not permitted
- Error: Process not found
- Error: Python debugging symbols not found (Linux, Python < 3.14)
- Error: GDB not found (Linux, Python < 3.14)
- Error: LLDB not found (macOS, Python < 3.14)
- Error: Timeout attaching to process
- Error: Debugger not found in PATH (v0.1.20+)
- Error: Attach debugger script not found (v0.1.20+)
- Error: C extension injector not found (v0.1.20+)
- Error: C extension not loadable in target process (v0.1.21+)
- Error: GDB/LLDB injection failed: debugger script error detected (v0.1.20+)
- v0.1.13 Version Issues
- Observation Issues
- Performance Issues
- Output Issues
- Docker Issues
- TUI Issues
- Other Issues
- Getting Help
- Related Documentation
Attachment Issues
Error: Operation not permitted
Symptom:
Error: Operation not permitted: ptrace access denied
Cause: Insufficient permissions to attach to the target process.
Solutions:
Solution 1: Use Same User
# Confirm target process owner
ps -o user= -p <pid>
# Run Peeka with the same user
peeka-cli attach <pid>
Solution 2: Use sudo
sudo peeka-cli attach <pid>
Solution 3: Adjust ptrace_scope
# Check current setting
cat /proc/sys/kernel/yama/ptrace_scope
# Temporary modification (for testing)
echo 1 | sudo tee /proc/sys/kernel/yama/ptrace_scope
# Permanent modification
echo "kernel.yama.ptrace_scope = 1" | sudo tee /etc/sysctl.d/10-ptrace.conf
sudo sysctl -p /etc/sysctl.d/10-ptrace.conf
Solution 4: SELinux Configuration (RHEL/Fedora)
# Check SELinux status
getenforce
# Temporarily allow ptrace
sudo setsebool -P deny_ptrace off
# Or create SELinux policy
Error: Process not found
Symptom:
Error: Process 12345 not found
Cause: PID doesn’t exist or process has exited.
Solution:
# Confirm process exists
ps -p 12345
# Re-find PID
ps aux | grep "your_app"
pgrep -f "your_app.py"
Error: Python debugging symbols not found (Linux, Python < 3.14)
Symptom:
Error: Python debugging symbols not found. Install python3-dbg.
Cause: Python debugging symbols not installed (required for the Linux GDB fallback).
Solution:
# Debian/Ubuntu
sudo apt-get update
sudo apt-get install python3-dbg
# RHEL/CentOS/Fedora
sudo yum install python3-debuginfo
# Verify installation
python3 -c "import sys; print(hasattr(sys, 'gettotalrefcount'))"
# Should output True
Error: GDB not found (Linux, Python < 3.14)
Symptom:
Error: GDB not found. Please install GDB.
Cause: GDB is not installed.
Solution:
# Debian/Ubuntu
sudo apt-get install gdb
# RHEL/CentOS
sudo yum install gdb
# Verify version (requires 7.3+)
gdb --version
Error: LLDB not found (macOS, Python < 3.14)
Symptom:
Error: LLDB not found
Cause: Xcode Command Line Tools are not installed.
Solution:
xcode-select --install
lldb --version
Error: Timeout attaching to process
Symptom:
Error: Timeout attaching to process after 30 seconds
Cause:
- Target process is hung or unresponsive
- Attach timeout too short
- High system load
Solution:
# Solution 1: Increase timeout
peeka-cli attach <pid> --timeout 60
# Solution 2: Check process status
ps -p <pid> -o stat=
# D: Uninterruptible sleep (possibly hung)
# R/S: Normal running
# Solution 3: Check system load
top
uptime
Error: Debugger not found in PATH (v0.1.20+)
Symptom:
Error: Debugger not found in PATH: gdb
Cause: Python versions below 3.14 require GDB (Linux) or LLDB (macOS) as the fallback attach mechanism, but the debugger is not installed or is not in PATH.
Solutions:
# Debian/Ubuntu
sudo apt-get install gdb
# RHEL/CentOS
sudo yum install gdb
# macOS
xcode-select --install
# Verify
gdb --version
lldb --version
Error: Attach debugger script not found (v0.1.20+)
Symptom:
Error: Attach debugger script not found: _attach.gdb
Cause: Peeka package resource resolution failed, usually because the installation is incomplete or a packaging tool such as PyInstaller did not include data files.
Solutions:
# 1. Reinstall Peeka
pip install --force-reinstall peeka
# 2. Check whether the script exists inside the package
python -c "import peeka.core.attach_workflow, pathlib; print(pathlib.Path(peeka.core.attach_workflow.__file__).parent / '_attach.gdb')"
# 3. For custom packaging, include peeka/core/attach_workflow/_attach.gdb and _attach.lldb
Error: C extension injector not found (v0.1.20+)
Symptom:
Error: C extension injector not found
Cause: The C extension such as peeka_injector was not compiled or loaded correctly. This is common after a failed source build or missing packaged extension.
Solutions:
# 1. Reinstall, preferably using a prebuilt wheel
pip install --force-reinstall peeka
# 2. When installing from source, ensure a compiler toolchain is available
pip install --no-binary :all: peeka
# 3. Verify that the extension exists
python -c "import peeka_injector; print(peeka_injector.__file__)"
Error: C extension not loadable in target process (v0.1.21+)
Symptom:
Error: C extension not loadable in target process <pid> (<reason>). The peeka C injector was built against a newer libc/ABI than the target environment provides ...
Cause: The GDB path dlopen()s Peeka’s C injector extension inside the target process. Since v0.1.21, before launching GDB, Peeka checks whether the extension can load using the target’s own interpreter (entering the target’s mount namespace with nsenter when needed). If the host running Peeka has a newer glibc than the target environment (common when attaching to a process in an older-distro container, such as a Debian python:3.8 image with GLIBC 2.31), the check fails and reports this error immediately instead of timing out after GDB runs.
Solution:
# 1. Upgrade to v0.1.21+: PyPI wheels are now cp38-abi3 wheels built on manylinux2014 (glibc 2.17), which load on older distros
pip install -U peeka
# 2. Or install and run peeka inside the target environment (for example, inside the container)
docker exec -it <container> pip install peeka
docker exec -it <container> peeka-cli attach <pid>
Error: GDB/LLDB injection failed: debugger script error detected (v0.1.20+)
Symptom:
Error: GDB injection failed: debugger script error detected
Cause: GDB/LLDB failed while loading Peeka’s _attach.gdb / _attach.lldb script. Possible causes include mismatched debugging symbols, incompatible Python versions, or abnormal target process state.
Solutions:
# 1. Confirm Python debugging symbols are installed (Linux, Python < 3.14)
sudo apt-get install python3-dbg # Debian/Ubuntu
# 2. Check whether the target process can be debugged
ps -p <pid> -o stat=
# 3. Run GDB manually to inspect detailed errors
gdb -p <pid> -x /path/to/_attach.gdb
# 4. On macOS, use LLDB and check Xcode Command Line Tools
lldb --version
xcode-select --install
v0.1.13 Version Issues
watch –times Counting Behavior Changed in v0.1.13 (Refined in v0.1.18)
Symptom: After upgrading to v0.1.13, watch --times N counting behavior differs from previous versions. After upgrading to v0.1.18, if multiple watch/trace/stack streams run concurrently, --times counting may be more stable than before.
Cause: v0.1.13 moved --times counting logic from agent-side to client-side. Previous versions counted inside the target process, the new version counts observations on the client side. v0.1.18 further filters client-side counting by active stream_id: only observations belonging to the current command stream are counted toward --times, so concurrent streams no longer affect the limit.
Impact:
- Count resets after client disconnect and reconnect
- Multiple clients can independently set their own
--timeslimits - v0.1.18+: Concurrent watch/trace/stack/monitor/top streams within the same client do not interfere with each other’s counts
Solution:
This is an expected behavior change. For detailed behavior changes and usage scenarios, see the watch command documentation.
Attach Reliability Improvements (v0.1.9-v0.1.12)
Improvements: Versions v0.1.9 to v0.1.12 introduced multiple reliability improvements to the attach command, including more descriptive error messages, better exception handling, and timeout control.
Related commits: 88da13e, a90d080, 9ef3222, 9c90675
For detailed improvement content, see the attach command documentation.
Observation Issues
A command response was lost
If the client reports outcome_uncertain: true, the command may have taken effect. Reconnect and check the resource or probe state before repeating the command.
No Observation Data
Symptom: watch command starts but no observation data is output.
Cause:
- Function name spelling error
- Function not being called
- Condition expression too strict
- Observation count limit reached
Solutions:
Check Function Name
# Use sc/sm to search for correct function name
peeka-cli sc "Calculator"
peeka-cli sm "add"
# Use fully qualified name
peeka-cli watch "demo.Calculator.add" # ✅
peeka-cli watch "Calculator.add" # ❌
Confirm Function is Called
# Check if target process is running
ps -p <pid>
# Check process logs
tail -f /var/log/your_app.log
Simplify Condition Expression
# First observe without conditions
peeka-cli watch "demo.func" --times 5
# After confirming data, add conditions
peeka-cli watch "demo.func" --condition "cost > 100" --times 5
Increase Observation Count
# Default -1 (infinite)
peeka-cli watch "demo.func"
# Or explicitly specify
peeka-cli watch "demo.func" --times 100
Incomplete Observation Data
Symptom: Observed parameters or return values show as <truncated> or incomplete.
Cause: Output depth limit.
Solution:
# Increase output depth (default 2)
peeka-cli watch "demo.func" --depth 5
# Depth explanation:
# 1: Only show type
# 2: Show one layer of structure
# 5+: Show deep nesting
Condition Expression Error
Symptom:
Error: Invalid condition expression: name 'invalid_var' is not defined
Cause: Condition expression uses non-existent variables or unsafe functions.
Solutions:
Available Variables
# ✅ Correct variables
params # Parameter list
kwargs # Keyword arguments
returnObj # Return value
throwExp # Exception object
cost # Execution time (milliseconds)
target # Target object (instance method)
Safe Functions
# ✅ Allowed functions
len(), str(), int(), float(), bool()
type(), isinstance()
min(), max(), sum()
# ❌ Disallowed functions
eval(), exec(), compile()
open(), read(), write()
__import__()
Examples
# ✅ Correct
--condition "len(params) > 2"
--condition "params[0] > 100 and cost > 50"
--condition "returnObj is not None"
# ❌ Incorrect
--condition "my_var > 100" # my_var doesn't exist
--condition "eval('1+1')" # eval not allowed
--condition "open('/etc/passwd')" # open not allowed
Performance Issues
Target Process Slows Down
Symptom: After attaching Peeka, target process response slows down.
Cause:
- trace command overhead too high (Python < 3.12)
- Observation frequency too high
- Output depth too large
Solutions:
Use Python 3.12+
Python 3.12+ trace command uses sys.monitoring API with overhead < 5%.
Limit Observation Frequency
# ✅ Limit observation count
peeka-cli watch "func" --times 10
# ✅ Use conditional filtering
peeka-cli watch "func" --condition "cost > 100"
# ❌ Infinite observation of high-frequency function
peeka-cli watch "high_frequency_func"
Reduce Output Depth
# ✅ Use default depth
peeka-cli watch "func" # depth=2
# ❌ Excessive depth
peeka-cli watch "func" --depth 10
Stop Unnecessary Observations
# Stop watch
peeka-cli reset "func"
# Or detach from process
peeka-cli detach <pid>
Peeka Client Slow Response
Symptom: Peeka commands execute slowly, data transmission has high latency.
Cause:
- Observation data volume too large
- Unix Socket buffer full
- High CPU load
Solutions:
# Reduce data volume
peeka-cli watch "func" --times 10 --condition "cost > 100"
# Check system resources
top
df -h
# Clean up old socket files
rm -f /tmp/peeka_*.sock
Output Issues
JSON Parsing Error
Symptom:
Error: Expecting value: line 1 column 1 (char 0)
Cause: Output contains non-JSON content (such as print statements).
Solutions:
# Extract only JSON lines
peeka-cli watch "func" | grep '^{' | jq
# Or use Python filter
peeka-cli watch "func" | python -c '
import sys, json
for line in sys.stdin:
try:
msg = json.loads(line)
print(json.dumps(msg))
except:
pass
'
Garbled Output
Symptom: Output contains garbled characters.
Cause: Encoding issue.
Solutions:
# Set correct locale
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# Or use Python processing
peeka-cli watch "func" | python -c '
import sys
for line in sys.stdin:
print(line, end="")
' 2>&1 | tee output.log
Docker Issues
Unable to Attach in Docker Container
Symptom:
Error: Operation not permitted (Docker)
Cause: Container lacks SYS_PTRACE capability.
Solutions:
docker run
docker run --cap-add=SYS_PTRACE --security-opt seccomp=unconfined your-image
docker-compose.yml
services:
app:
image: your-image
cap_add:
- SYS_PTRACE
security_opt:
- seccomp=unconfined
Kubernetes
apiVersion: v1
kind: Pod
spec:
containers:
- name: app
securityContext:
capabilities:
add: ["SYS_PTRACE"]
TUI Issues
TUI Display Abnormal
Symptom: TUI interface display garbled or cannot render properly.
Cause: Terminal compatibility issue.
Solutions:
# Check if terminal type supports 256 color
echo $TERM
# Or use CLI mode
peeka-cli watch "func"
TUI Colors Broken in Docker Container
Symptom: After entering a container via docker exec, TUI colors are missing or Header/Footer are indistinguishable from the main body.
Cause: docker exec does not inherit host terminal environment variables (TERM, COLORTERM). The container defaults to TERM=dumb, and Textual cannot detect truecolor support.
Solutions:
Peeka test images have TERM=xterm-256color and COLORTERM=truecolor baked in. TUI works out of the box via docker exec — no manual env setup needed.
TUI Freezes
Symptom: TUI interface unresponsive.
Cause:
- Data flow too fast
- Background thread blocking
Solutions:
# Use Ctrl+C to exit
# Use CLI instead
peeka-cli watch "func" --times 10
Other Issues
Socket File Conflict
Symptom:
Error: Address already in use: /tmp/peeka_12345.sock
Cause: Previous abnormal exit didn’t clean up socket file.
Solutions:
# Delete old socket file
rm -f /tmp/peeka_12345.sock
# Or use different socket directory
peeka-cli attach 12345 --socket-dir /tmp/my_peeka
High Memory Usage
Symptom: Peeka or target process has high memory usage.
Cause: Observation data buffer too large.
Solutions:
# Limit observation count
peeka-cli watch "func" --times 100
# Periodically reset observations
peeka-cli reset "func"
# Or detach from process
peeka-cli detach <pid>
Module Not Found
Symptom:
Error: No module named 'peeka'
Cause: Installation issue.
Solutions:
# Reinstall
pip uninstall peeka
pip install peeka
# Or use uv
uv pip install peeka
# Verify installation
python -c "import peeka; print(peeka.__version__)"
Getting Help
If none of the above solutions resolve your issue:
- View logs:
peeka-cli --verbose attach <pid> -
GitHub Issues: https://github.com/peeka-project/peeka/issues
- Provide information:
- Operating system and version
- Python version
- Peeka version
- Complete error message
- Reproduction steps
- Community discussion:
- GitHub Discussions
- Stack Overflow (tag:
peeka)