Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snapshot functionality - library part #1307

Closed
michalbiesek opened this issue Feb 2, 2023 · 3 comments · Fixed by #1308
Closed

Snapshot functionality - library part #1307

michalbiesek opened this issue Feb 2, 2023 · 3 comments · Fixed by #1308
Assignees

Comments

@michalbiesek
Copy link
Contributor

michalbiesek commented Feb 2, 2023

  • replace SCOPE_ERROR_SIGNAL_HANDLER with snapshot logic
  • handle new configuration options related to snapshot options
  • if the snapshot is enabled install our handler
  • generate snapshot in following location /tmp/appscope/<PID>
  • enable snapshot is done via enabling coredump and/or enabling backtrace
  • generating configuration and general information about process is mandatory if snapshot is enabled
  • generating coredump and backtrace is optional depending on configuration settings
  • call SIGSTOP after generating snapshot
  • after receiving SIGCONT call orignal application handler
  • Details of files generated by library
@michalbiesek michalbiesek self-assigned this Feb 2, 2023
@michalbiesek michalbiesek changed the title Library support for snapshot Snapshot functionality - library part Feb 2, 2023
michalbiesek added a commit that referenced this issue Feb 2, 2023
- replace `SCOPE_ERROR_SIGNAL_HANDLER` with snapshot

Closes: #1307
@michalbiesek
Copy link
Contributor Author

michalbiesek commented Feb 3, 2023

@abetones:
This issue will be resolved in v1.3.0.
The snapshot feature extends the crash analysis capabilities of the scoped process.
Following changes needs to be updated accordingly:

We will discuss the details of this in the future.

This comment here is just a mark point.

@michalbiesek michalbiesek linked a pull request Feb 3, 2023 that will close this issue
1 task
@michalbiesek
Copy link
Contributor Author

michalbiesek commented Feb 3, 2023

QA instructions

The instructions below can be used for different applications but I would recommend testing logic on the application which by itself registers a signal handler for SIGSEGV, SIGINT, SIGILL, SIGFPE, e.g. Redis does it.

Snapshot description

  1. Attach Scenario

In terminal 1

# Start redis
redis-server --port 7878

In terminal 2

# Attach to redis
sudo SCOPE_SNAPSHOT_COREDUMP=true SCOPE_SNAPSHOT_BACKTRACE=true ./bin/linux/x86_64/scope attach <redis_pid>
# Send SIGSEGV signal
kill -SIGSEGV <redis_pid>
# The <redis_pid> should stopped - on terminal 1 You should see
# [1]+  Stopped                 redis-server --port 7878
# or You can: `grep  State /proc/<redis_pid>/status` to see stopped status
# At this point You can verify that snapshot files were created in /tmp/appscope/<redis_pid>
# The content of it should reflect the Snapshot description mentioned above

# Allow redis to continue
kill -SIGCONT <redis_pid>

The process should have ended and the redis itself should generate its own backtrace on stdout see the function logStackTrace/printCrashReport (depending on Your work env) is coming from redis
The signal mentioned in redis stacktrace should point to SIGSEGV:

Redis 5.0.7 crashed by signal: 11
  1. Scoping from beginning
    The scenario is very similar to first one. We will use single terminal.

Terminal 1

SCOPE_SNAPSHOT_COREDUMP=true SCOPE_SNAPSHOT_BACKTRACE=true ./bin/linux/x86_64/scope redis-server --port 7878
# Send SIGSEGV signal
....

Rest of steps are the same like in scenario 1 and behavior should be just like the one described in the scenario 1.

jrcheli added a commit that referenced this issue Feb 3, 2023
michalbiesek added a commit to michalbiesek/appscope that referenced this issue Feb 3, 2023
- replace `SCOPE_ERROR_SIGNAL_HANDLER` with snapshot

Closes: criblio#1307
michalbiesek added a commit to michalbiesek/appscope that referenced this issue Feb 3, 2023
michalbiesek pushed a commit to michalbiesek/appscope that referenced this issue Feb 3, 2023
@jrcheli
Copy link
Contributor

jrcheli commented Feb 3, 2023

Manually setting this issue to closed, since it's been merged into release/1.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

2 participants