How to simulate process/daemon crash on OSX? - macos

How can I invoke/simulate process/daemon crash on OSX and as result to receive crash report in
/Library/Logs/DiagnosticRepors
(e.g. opendirectoryd_2013-06-11-125032_macmini61.crash)?
I tried to make force quit for daemons using Activity Monitor but didn't receive any report. I need to crash some system or third party process (NOT developed by myself).

You can force almost any process to crash by sending it a "segmentation violation" signal.
Example: Find process id of "opendirectoryd":
$ ps -ef | grep opendirectoryd
0 15 1 0 9:14am ?? 0:01.11 /usr/libexec/opendirectoryd
^-- process id
Send signal to the process:
$ sudo kill -SEGV 15
This terminates the process and causes a diagnostic report to be written,
as can be verified in "system.log":
Oct 31 09:17:17 hostname com.apple.launchd[1] (com.apple.opendirectoryd[15]): Job appears to have crashed: Segmentation fault: 11
Oct 31 09:17:20 hostname ReportCrash[420]: Saved crash report for opendirectoryd[15] version ??? (???) to /Library/Logs/DiagnosticReports/opendirectoryd_2013-10-31-091720_localhost.crash
But note that deliberately crashing system services might cause severe problems (system instability, data loss, ...), so you should know exactly what you are doing.

Unless you can find a legitimate bug and get it to crash that way, you can't externally crash a daemon in such a fashion that it will result in a diagnostic report. All of the quit-forcing functions are exempt from diagnostic reports as they are external issues.

Related

NS3_Can't run vanet-routing-compare.cc

I'm new to NS3. I studied vanet-routing-compair.cc script. I tried to run it by these commands (vanet-routing-compare.cc is in scratch folder).
./waf --run scratch/vanet-routing-compare
./waf --run "vanet-routing-compare --scenario=1 --saveconfig=scenario1.txt"
But I'm getting confused with the results. I get following error messages.
msg="Could not connect callback to /NodeList/*/DeviceList/*/ns3::WifiNetDevice/Phy/PhyTxDrop", file=../src/core/model/config.cc, line=920 terminate called without an active exception
Command ['/home/azra/Desktop/ns-allinone-3.31/ns-3.31/build/scratch/vanet-routing-compare'] terminated with signal SIGIOT. Run it under a debugger to get more information (./waf --run <program> --gdb").
And by using the gdb debugger, I see this message.
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/azra/Desktop/ns-allinone-3.31/ns-3.31/build/scratch/vanet-routing- compare --scenario=1 --saveconfig=scenario1.txt
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
msg="Could not connect callback to /NodeList/*/DeviceList/*/ns3::WifiNetDevice /Phy/PhyTxDrop", file=../src/core/model/config.cc, line=920
terminate called without an active exception
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig#entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 }
I appreciate who can help me understand why this is happening and how I can solve it.
I got the same error in version 3.31, but the version 3.30 is ok. Maybe you can also try version 3.30.
I believe since version 3.31 the names changed from ns3:: to $ns3::
https://groups.google.com/g/ns-3-users/c/VWTV9ZdY7fs/m/MxRdIoLoAAAJ[Here][1]
The workaround I use is to copy the entire file from here:gitlab of ns3 development branch
As you can see, there were few (more than a few) changes in the code.

Thread 'main' panicked at 'could not initialize thread_rng: All entropy sources failed

After running a cross-compiled Rust ARM binary on a Raspberry Pi Zero for a few hours, the process panics with the following error:
1 Feb 02 12:03:17 raspberrypi monitoring-service[339]: thread 'main'
panicked at 'could not initialize thread_rng: All entropy sources failed (permanently unavailable); cause: getrandom not ready (not ready
yet); cause: Resource temporarily unavailable (os error 11)', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.6.1/src/rngs/thread.rs:82:17
systemd tried to restart the process, but it failed with the same error several times. The next day I was able to manually restart it, but countdown to when it fails again.
I suspect this is caused by the ws websocket crate indirectly using the rand v0.6.1 crate, but I'm not sure.
Is there a way to force these packages to use a newer version of the rand crate, or do I need to tweak an OS setting on Raspbian? I'm running Raspbian Stretch (v9), kernel v4.14.79+. As an internal monitoring tool, my application requires no encryption or privacy so ideally I can get around the entropy issue.

Errors when generating mixed mode Flame Graphs

I'm trying to generate some mixed mode flame graphs on a Linux machine (CentOS 7) and running into some issues.
I'm following instructions from this link: https://www.slideshare.net/brendangregg/java-performance-analysis-on-linux-with-flame-graphs (starting from slide 47).
when I run the below command to collect perf data:
perf record -F 997 -a -g --sleep <time in seconds>; jmaps
It seems to generate perf.data with no errors. However, when I try to process the perf.data by running the below command,
perf script --input=perf.data > out.stacks01
it shows me below messages:
/tmp/libnetty-transport-native-epoll6943913993058681852.so was updated (is prelink enabled?). Restart the long running apps that use it!
corrupted callchain, skipping
Does anyone have any idea what these messages mean?

What are the exit status codes for the G-WAN executable?

I'm trying to serve a big number of small files with G-WAN (version 4.3.14, started with sudo on 64-bit Ubuntu 14.04.3). I start hammering it with requests over a single connection using wget to provide base URL and a file with a list of the URL suffixes. At some point, which is different for different runs, the gwan executable silently exits. There's no trace in the gwan log or in the site error log (I did change '_log' to 'log' to enable logging). The exit status code is 139. What does it mean? When I stop it with Ctrl-C the exit code is 130.
Is there a reference for the exit status codes? I cannot find any with Google.
First, Ubuntu 14.04.3 is very recent while G-WAN v4.3.14 is very old. Almost every new OS release introduces cincompatibilities that require patches and this is why we have to issue more recent releases for registered users. This explains the 'silent exits' that you are experiencing.
Second, process exits codes can be found this way:
./gwan -h
echo $?
0
Zero means no error, and any other value is an error (mixing system flags to be as informative as possible). That's why Ctrl+C returns 130: Control-C is fatal error signal 2, (130 = 128 + 2).

CDT 6 (eclipse galileo) snow leopard debugging issue

I upgrade to snow leopard and Xcode 3.2 this week, and since that, I'm having problems with CDT. I tried this in CDT 5 (Ganymede) and CDT 6 (Galileo).
If I try to debug the application using launcher "Standard Create Process Launcher", it delays about 10 seconds to actually get in the debugging breakpoint, which is very odd.
If I use as launcher "GDB (DSF) Create Process Launcher" it works at the speed I expect, but the variables tab that shows me what's going on in the current scope show the variable values like that:
"Failed to execute MI command:
-var-update 1 var2
Error message from debugger back end:
Variable object not found
Failed to execute MI command:
-var-update 1 var1
Error message from debugger back end:
Variable object not found"
I don't have any idea how to solve one or the other issue, any of them will let me work up to speed.

Resources