DTrace freezes M1 MacOS Ventura 13.5

Hello,

I'm trying to use dtrace to instrument my applications with no success.

The system freezes on the exact moment I'm starting the command from terminal. The only way out is hard shut down via long pressing the power button.

Are there any solutions for this?

  • Hey there Permissions & SIP: If you're on a newer macOS version, the System Integrity Protection (SIP) can interfere with dtrace. While I don't recommend it for long-term use, you might want to try disabling SIP temporarily to see if it makes a difference. Boot into Recovery Mode (by holding Command + R during startup) > Utilities > Terminal, then enter csrutil disable.

    Hope this helps, you get to the bottom of this issue soon.

    Ahmad.

  • Same issue here - with SIP disabled.

  • I have this too. This completely locks up my system. No wake or sleep involved. Restart, try to use dtrace (via dtruss) and boom freeze everything but the UI.

Accepted Reply

You might be hitting an issue where some hardware memory protection gets incorrectly reenabled for a SIP-disabled system upon wake from sleep, which then causes the DTrace freeze you are seeing.

I'm assuming you already have SIP disabled on your machine (if not that would be the first step). However, in some cases when the machine goes to sleep and wakes up some memory protection that was disabled as part of disabling SIP may get reenabled. This prevents DTrace from writing to a memory region it needs and causes it to freeze. A reboot will reset the permission and protection settings correctly.

So as a workaround until this is fixed, you can try to prevent your machine from going to sleep after a reboot or reboot before you want to use DTrace. We are investigating the issue. If you would like to be notified when this is fixed, feel free to file a feedback and post it here. We can then link it to the internal issue.

If you are seeing this behavior with SIP disabled after a fresh reboot (without the machine going to sleep in-between), please let us know.

  • I want to mention that sometimes system failure happens after the long usage of the DTrace with different scripts, when some random, previously working script, hangs the system.

  • Thanks a lot @Developer Tools Engineer! I confirm keeping system awake fixes the problem for me. My intuition was that it had something to do with the system uptime, as it was indeed working correctly after a reboot and only after a period of time starting to reproduce. It makes more sense now that sleep was causing it.

  • I seem to be having a related problem, but it occurs even right after booting. When I run, say sudo dtruss ls, the command hangs indefinitely. Other things on my system then start failing – I can't run commands in other terminal windows. Tabs don't open in my browser. Applications won't open. Etc. Eventually, I just have to reboot. Please let me know if I can provide any information to help debug this. (I'm running 13.3 right now. I'll upgrade and see if the problem remains.)

Replies

You might be hitting an issue where some hardware memory protection gets incorrectly reenabled for a SIP-disabled system upon wake from sleep, which then causes the DTrace freeze you are seeing.

I'm assuming you already have SIP disabled on your machine (if not that would be the first step). However, in some cases when the machine goes to sleep and wakes up some memory protection that was disabled as part of disabling SIP may get reenabled. This prevents DTrace from writing to a memory region it needs and causes it to freeze. A reboot will reset the permission and protection settings correctly.

So as a workaround until this is fixed, you can try to prevent your machine from going to sleep after a reboot or reboot before you want to use DTrace. We are investigating the issue. If you would like to be notified when this is fixed, feel free to file a feedback and post it here. We can then link it to the internal issue.

If you are seeing this behavior with SIP disabled after a fresh reboot (without the machine going to sleep in-between), please let us know.

  • I want to mention that sometimes system failure happens after the long usage of the DTrace with different scripts, when some random, previously working script, hangs the system.

  • Thanks a lot @Developer Tools Engineer! I confirm keeping system awake fixes the problem for me. My intuition was that it had something to do with the system uptime, as it was indeed working correctly after a reboot and only after a period of time starting to reproduce. It makes more sense now that sleep was causing it.

  • I seem to be having a related problem, but it occurs even right after booting. When I run, say sudo dtruss ls, the command hangs indefinitely. Other things on my system then start failing – I can't run commands in other terminal windows. Tabs don't open in my browser. Applications won't open. Etc. Eventually, I just have to reboot. Please let me know if I can provide any information to help debug this. (I'm running 13.3 right now. I'll upgrade and see if the problem remains.)