When running node --prof <command>, then later node --prof-process on macOS, my profiling output no-longer shows any of the C++ entry points, leading to a lot of unaccounted-for gaps in my profiling data. Changed around the same time, I now just see the node binary in these profiling trees where it wasn't showing up before, so it's like the profiler is no-longer able to "dive in" to the internals of node.
I think this started when trying to improve dtrace permissions with csrutil, but I've restored things back to their factory settings and this still happens.
What causes C++ entry points to not show up in traces? Is there a way to fix the issue?
Update:
Just tried turning off SIP entirely with csrutil disable (which is a bad thing to do), and the problem persists, so maybe SIP is a red herring here.
The amazing wizards in the node.js github issues figured this out.
In short, I learned that two commands are used by the profiler on macOS: c++filt and nm. When I tried reporting which versions of those commands I had installed, I got this message back for nm:
» nm --version
Agreeing to the Xcode/iOS license requires admin privileges, please run “sudo xcodebuild -license” and then retry this command.
Apparently the requirement of accepting the license was added, perhaps after an upgrade, and this was blocking the ability for the profiler to look up and demangle C++ symbols. After I accepted the license, the profiler started working normally again.
Hopefully this helps others running across the same scenario.
Related
Something has caused my Rust language tools to stop working as expected recently. I hadn't been in a Rust file for about 2 weeks, came back and I no longer have all the diagnostic info from the language server in the buffer. No gutter hints, no underlines, no LSP-Saga goodness. Oddly I still have some inlay hints. ?? I could use some help troubleshooting where to dig on this.
Nvim version:
NVIM v0.8.0-1210-gd367ed9b2
LuaJIT 2.1.0-beta3
Packer installs related to rust:
nvim-lspconfig (though not using it to configure rust, see tools below)
Mason and mason-lspconfig
simrat39/rust-tools
Rust-Analyzer and codelldb installed through Mason and updated
So far I have tried removing rust-tools and and configuring through lspconfigs. No luck. I also confirmed with :LspInfo that the language server is running and attached with both config options. I removed LSPSaga, combed through everything touching vim.diagnostic and turned things off / back on, no love there either.
The strange thing is I still have my Typescript, Lua, Svelte and Go support, full featured and totally unchanged, so it's more than likely something specific to Rust. I did run PackerSync a few times because I was playing with themes and saw some updates on other plugins that I didn't pay a lot of attention to. No new issues on any of the github repos related to Rust either, at least not with this issue. Something changed somewhere, but I could definitely use some direction tracking it down.
Any thoughts?
Edit
I was able to get partial support back. I did this by uninstalling the language server with Mason, then installing an older version directly within linux and adding it to $PATH. At this point things some of the things turned back on, but not all. I then removed the binary from $PATH and reinstalled the latest version with Mason, and the things that started working again kept working.
This one has me stumped, but I got enough functionality back to work comfortably again.
I've installed and executed (with nodejs) a package from npm: https://www.npmjs.com/package/openssl.js
Somehow I didn't realize that it hasn't a good reputation (almost no activity/stars on twitter, github). Now I'm afraid that it is a scam. The worst case would be that is stealing/encrypting my data or something like that.
I've checked the processes, I/O and network in the activity monitor but nothing interesting.
But I would like to have more confidence that everything is okay.
Since it is a Wasm file I cannot just check the source code.
I've tried to decompile with this tool: https://github.com/WebAssembly/wabt but it gives me for all binaries in that project this error: error: #0x00000004: bad magic value.
Maybe because in the README of the openssl.js package they claim it is build with wasienv toolchain?
Another idea would be install a honeypot and run the same commands in the honeypot. But which honeypot is suitable for this?
// edit
I was able to run wasm2c on this file: src/raw-wasm/openssl.wasm.
But how can I ensure there was no network interactivity?
Here are the first lines of the output: https://pastebin.com/YYHecFAC
I'm currently running a heavily modified Synology DSM (x86 bromolow based) on my server (bootstrapped, etc.), and for some services, I would need node.js.
And thus, I've been following the tutorials, more or less. Installed the required packages (python2.7, make, gcc, etcetera), grabbed the source, checked out the latest stable, and tried to compile.
But I ran into a slight issue while trying to run configure. Here's the output log: http://pastebin.com/BPXX4XiY
Then tried with Python2.6 too: http://pastebin.com/Xg4qHspG
Problem is, Error 38 and "Function not implemented" does not give a slightest hint on what might be missing - there is simply no reference to it.
Did anyone else have this problem, and if yes, how did you solve it?
EDIT
Using the solution from here, it still does not work. /dev/shm/ (after manually creating the node, and mounting it) is there, with 0777 access rights, and yet Python still returns the same error.
I'd like to generate a flame graph for my node.js app. Unfortunately, my dev box is OSX (doesn't support utrace helpers, per the linked article) and my production box is CentOS (doesn't even have dtrace).
I've found some indication that something like SystemTap might be a dtrace alternative, but I've been unable to cobble together an effective working way to generate the appropriate stacks.out file to feed into stackvis.
Does anybody know of a decent tutorial on how to get this up and running? I'd prefer it on CentOS (so I can examine my production app) but OSX would also be sufficient.
From the latest google searches, people are unhappy with SystemTap on Centos, but here is an article http://dtrace.org/blogs/brendan/2012/03/17/linux-kernel-performance-flame-graphs/ that was referenced by someone's FlameGraph github project https://github.com/brendangregg/FlameGraph
I would say move towards the real solution, of getting dtrace installed rather than relying on the work around.
On Linux, the perf_events profiler can be used to sample stack traces, and has JIT symbol support. For node.js, you need to be running version 0.11.13 or higher, with the v8 option --perf-basic-prof. That option creates a /tmp/perf-PID.map file for symbol translation, which perf uses. Once you have perf profiling stack traces with JavaScript symbols, you can then create flame graphs using stackcollapse-perf.pl (from the FlameGraph repo) on the output of "perf script".
I wrote up the full instructions here: http://www.brendangregg.com/blog/2014-09-17/node-flame-graphs-on-linux.html
I need your help. Because I've no idea what I'm doing.
There is this nice plugin vim-instant-markdown I recently stumbled onto. Basically, it's a live preview in a browser, running in the background, while you're writing your text in markdown plugin, and I like the concept.
So, I've tried to get it to work on Windows,
installed Ruby (rubyinstaller-1.9.3-p125)
installed Ruby-DevKit (DevKit-tdm-32-4.5.2-20111229-1559-sfx)
followed instructions on https://github.com/oneclick/rubyinstaller/wiki/Development-Kit
gem install redcarpet pygments.rb
installed node (node-v0.6.10)
npm -g install instant-markdown-d
So far so good,
I open a markdown file in Vim, and it opens (pause button works here) a command line window with my text inside. Browser not seen anywhere.
In the plugin there is an /dev/null "thing" (I'm not an unix guy, more than I needed to be, which wasn't very much - just an ordinary user for most part). /dev doesn't exist on Windows.
To put long story short, my question is - can this be made to work on Windows, the way it should work, or is it a waste of effort even to try it to get it to work?
I'm welcoming all constructive ideas and suggestions.
glad you found this useful enough to want a Windows port! I think it definitely can be done, you just might need more dependencies and hackage.
First of all, understand that there's a server component that is used apart from the actual .vim file to make this work, which is started and stopped on demand. You will definitely need to look at its code, which can be found here.
The server uses open on OSX and xdg-open on Linux to open a browser window, neither of which exist on Windows. On Windows, you can use start (more here). Try to find a way to make the browser window open in the background, and not steal focus, otherwise it will be very annoying.
Also, curl is used to send commands to the server, and curl doesn't exist for Windows. Indeed, I don't think anything similar exists. There is a curl Windows port, though IMO it kinda sucks to add such a thing as a requirement for the plugin...
It seems that you've taken this on at least partially as a learning experience, so I hope you can make it work and send back a pull request! (Of course feel free to keep asking questions if you're stuck) But in the (hopefully unlikely) event that you lose interest or give up, create an issue in github requesting Windows compatibility, and I'll see if I have time to implement it. Also, keep in mind that some questions/comments will be better suited to the project's issues area than here.
Good luck!