pigpio: Java Native Interface sigHandler: Unhandled signal 11, terminating

When using pigpio in Java through JNI the program terminates with

sigHandler: Unhandled signal 11, terminating

this happens when using interrupt functions such as gpioSetAlertFunc or gpioSetISTFunc even if these functions do absolutely nothing.

This might be a JNI issue. If anyone has any ideas on how to use pigpio interrupts in Java I would greatly appreciate any suggestions.

I updated to latest java java version “1.8.0_131”

void interrupt_s(int gpio, int level, uint32_t tick)
{
   /*
      Callback does nothing
   */
}


JNIEXPORT jlong JNICALL Java_pigpioTest
  (JNIEnv *env, jobject obj, jint pin)
{
	//Initialize PIGPIO library
	if (gpioInitialise() < 0) {
		return 0;
	}
        // Set a single pin as input
	gpioSetMode(pin, PI_INPUT);
	gpioSetPullUpDown(pin, PI_PUD_DOWN);
	   /* monitor pin level changes */
	gpioSetAlertFunc(pin, interrupt_s);
	return 1;
}

The above runs for a while and then the sigHandler: Unhandled signal 11, terminating error happens.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 25 (10 by maintainers)

Most upvoted comments

I have compiled the lib with the define : make -j2 CFLAGS+=-DEMBEDDED_IN_VM, no more errors. I think @afterhoursengineering will see the same thing.

@guymcswain Do you think that it may be possible in a future pigpio version to add a function gpioCfgSetSignalHandling(bool enabled) to disable signal handling ? true by default, to keep existing behavior…