Saturday, March 28, 2020

Ubuntu's default Node JS version may not be what you want

I was trying to get a Node JS application running inside Bash on Ubuntu on Windows. I successfully installed Node with the Apt package manager, but some library failed to install, citing a missing node program. Symbolic-linking that to nodejs kind of worked but produced errors about unknown (seemingly newer) syntax. After some fiddling around I learned of NVM. Installing that and the current LTS Node version was easy and made the program work as expected.

Friday, March 27, 2020

Check reCAPTCHA after updating to phpBB 3.3

I operate two phpBB forums that use reCAPTCHA during registration for spam prevention. I just updated them to phpBB 3.3, which switches from checkbox captcha to the newer(?) "invisible reCAPTCHA." The demo in the board settings, though, showed an error message about invisible reCAPTCHA not being enabled for the site key. That makes sense since I registered the sites with the v2 checkbox verification. To make the captcha work again, I had to reregister the sites with reCAPTCHA as the v2 invisible verification and get new keys.

Wednesday, March 25, 2020

Avoiding infinite throw-catch loops

Previously I encountered a problem when doing bytecode instrumentation of try-catch blocks. The Java compiler sometimes emits exception table entries that register short regions as their own exception handlers. When code that can cause exceptions is inserted into the middle of these regions, an infinite loop results.

To avoid this with the ASM bytecode library, I just added a check in visitTryCatchBlock to see if the handler label was the same as the start label. If so, the function returns without passing the event along, removing the exception table entry. This can't break anything because if the handler was ever used under normal circumstances, it would trigger a thread-termination-resistant infinite loop, which I don't observe.

Sunday, March 22, 2020

Java exception tables can allow infinite loops

Today I worked with an application that does some Java bytecode instrumentation to intercept exception handling. The exception table of a method specifies which regions to detect exceptions in and where to jump if an exception occurs. In one class, an exception table entry's target ended up being the start of the covered region. If an exception occurred inside the region, an infinite loop would begin. That would even prevent the thread from being terminated because the ThreadDeath exception couldn't propagate out of the function.

Saturday, March 21, 2020

Restarting the audio service can fix microphone problems

Today in the middle of a call my laptop decided to stop getting audio input from its integrated microphone. Running the audio troubleshooter on the microphone didn't do anything, nor did disabling and reenabling the device. It started working again after restarting the audio service (Audiosrv). That can be done with one command from an administrative PowerShell prompt:

Restart-Service Audiosrv