Skip to content

SIGSEGV in ConnectionManager.unsubscribe() #47

Description

@wardev

Calling unsubscribe(...) on the same SubscriptionInfo twice results in a SIGSEGV.

ConnectionManager cm = ...;
SubscriptionInfo si = cm.subscribe(...);
cm.unsubscribe(si);
cm.unsubscribe(si);  // <-- this sends SIGSEGV to process

I would expect that the second call to unsubscribe(...) is a no-op since that subscription is not active anymore. At worst it should throw an exception that can be handled by the caller.

The issues appears to be that unsubscribe(...) calls delete on si, even though there are still live references to it, and that unsubscribe(...) is missing some null checks, specifically getInfo() may return null.

Backtrace from core dump:

C  [libGMSECAPI.so+0x374e66]  gmsec::api::SubscriptionInfo::getConnection() const+0x10
C  [libGMSECAPI.so+0x3eefdf]  gmsec::api::mist::internal::InternalConnectionManager::unsubscribe(gmsec::api::mist::SubscriptionInfo*&)+0xef
C  [libGMSECAPI.so+0x3775fa]  gmsec::api::mist::ConnectionManager::unsubscribe(gmsec::api::mist::SubscriptionInfo*&)+0x26
C  [libgmsec_jni.so+0xe9990]  Java_gov_nasa_gsfc_gmsec_api_jni_gmsecJNI_ConnectionManager_1Unsubscribe+0xa

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions