Skip to content

NWNX_ELC.so server crash #1857

@julien-lecomte

Description

@julien-lecomte

While doing manual ELC, when I login with a specific char, I get the nwserver to crash. The client goes to black screen and is non-responsive until a timeout occurs.

pc.tar.gz

The stack trace:

==============================================================
 NWNX 8193.37-17 (7f35f5c95a) has crashed. Fatal error: Segmentation fault (11).
 Please file a bug at https://github.com/nwnxee/unified/issues
==============================================================

  Backtrace:
    ./NWNX_Core.so(_ZN7NWNXLib8Platform13GetStackTraceB5cxx11Eh+0x3b) [0x7f2fd5b3f69b]
    ./NWNX_Core.so(nwnx_signal_handler+0xb1) [0x7f2fd5aeabf1]
    /lib/x86_64-linux-gnu/libc.so.6(+0x3fdf0) [0x7f2fd5559df0]
    /usr/share/nwnee-dedicated/bin/linux-x86/NWNX_ELC.so(+0x6e92) [0x7f2fd403fe92]
    ./nwserver-linux(_ZN21CServerExoAppInternal18LoadCharacterStartEhP10CNWSPlayer7CResRefPvj+0x1e2) [0x563618210592]
    ./nwserver-linux(_ZN13CServerExoApp18LoadCharacterStartEhP10CNWSPlayer7CResRefPvj+0x26) [0x5636181f9a26]
    ./nwserver-linux(_ZN11CNWSMessage32HandlePlayerToServerLoginMessageEP10CNWSPlayerh+0x16e) [0x56361825ed8e]
    ./nwserver-linux(_ZN11CNWSMessage27HandlePlayerToServerMessageEjPhj+0x4b0) [0x563618278070]
    ./nwserver-linux(_ZN21CServerExoAppInternal13HandleMessageEjPhj+0x7b0) [0x563618204440]
    ./nwserver-linux(_ZN17CNetLayerInternal17UncompressMessageEjPhj+0x423) [0x563617e9b983]
    ./nwserver-linux(_ZN15CNetLayerWindow23UnpacketizeFullMessagesEi+0x55a) [0x563617e9c82a]
    ./nwserver-linux(_ZN17CNetLayerInternal21ProcessReceivedFramesEi+0x49d) [0x563617eb91ed]
    ./nwserver-linux(_ZN21CServerExoAppInternal8MainLoopEv+0x645) [0x56361820dfa5]
    ./nwserver-linux(main+0x1235) [0x563617e022e5]
    /lib/x86_64-linux-gnu/libc.so.6(+0x29ca8) [0x7f2fd5543ca8]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85) [0x7f2fd5543d65]
    ./nwserver-linux(_start+0x2a) [0x563617e08caa]
bin/start-server: line 15: 2818739 Aborted                 nwserver

My server code, it could come from one of these two files:

void OnPlayerELC()
{
  int nType = NWNX_ELC_GetValidationFailureType();
  int nSubType = NWNX_ELC_GetValidationFailureSubType();

  if (nType == NWNX_ELC_VALIDATION_FAILURE_TYPE_FEAT && nSubType == NWNX_ELC_SUBTYPE_FEAT_NOT_AVAILABLE_TO_CLASS)
    NWNX_ELC_SkipValidationFailure();
  else if (nType == NWNX_ELC_VALIDATION_FAILURE_TYPE_FEAT && nSubType == NWNX_ELC_SUBTYPE_TOO_MANY_FEATS_THIS_LEVEL)
    NWNX_ELC_SkipValidationFailure();
  else if (nType == NWNX_ELC_VALIDATION_FAILURE_TYPE_FEAT && nSubType == NWNX_ELC_SUBTYPE_INVALID_FEAT)
    NWNX_ELC_SkipValidationFailure();
  else
  {
    LogDebug("un_elc_feats: NWNX_ELC_GetValidationFailureType: " + IntToString(nType) + ",  NWNX_ELC_GetValidationFailureSubType: " + IntToString(nSubType));
    return;
  }
}


// =============================================================================

void main()
{
  string sEvent = NWNX_Events_GetCurrentEvent();
  if (sEvent == "")
    SubscribeEvent(ON_PLAYER_ELC, __FILE__);
  else if (sEvent == ON_PLAYER_ELC)
    OnPlayerELC();
}

or


void OnPlayerELC()
{
  int nType = NWNX_ELC_GetValidationFailureType();
  int nSubType = NWNX_ELC_GetValidationFailureSubType();

  if (nType == NWNX_ELC_VALIDATION_FAILURE_TYPE_CHARACTER && nSubType == NWNX_ELC_SUBTYPE_ABILITY_POINT_BUY_SYSTEM_CALCULATION)
  {}
  else
  {
    LogDebug("fu_elc_ability: NWNX_ELC_GetValidationFailureType: " + IntToString(nType) + ",  NWNX_ELC_GetValidationFailureSubType: " + IntToString(nSubType));
    return;
  }

  object oModule = GetModule();
  NWNX_NWSQLiteExtensions_CreateVirtual2DATable("ruleset");

  // If a row exists, that means that the ruleset value was changed from the default.
  // We thus assume that the PC stats are correct.
  string sSQL = "SELECT * FROM ruleset WHERE label = 'CHARGEN_BASE_ABILITY_MIN' AND value != '8'";
  sqlquery sqlQuery = SqlPrepareQueryObject(oModule, sSQL);
  if (SqlStep(sqlQuery))
  {
    NWNX_ELC_SkipValidationFailure();
    return;
  }

  sSQL = "SELECT * FROM ruleset WHERE label = 'CHARGEN_BASE_ABILITY_MIN_PRIMARY' AND value != '11'";
  sqlQuery = SqlPrepareQueryObject(oModule, sSQL);
  if (SqlStep(sqlQuery))
  {
    NWNX_ELC_SkipValidationFailure();
    return;
  }

  sSQL = "SELECT * FROM ruleset WHERE label = 'CHARGEN_BASE_ABILITY_MAX' AND value != '18'";
  sqlQuery = SqlPrepareQueryObject(oModule, sSQL);
  if (SqlStep(sqlQuery))
  {
    NWNX_ELC_SkipValidationFailure();
    return;
  }

}


// =============================================================================

void main()
{
  if (!GetIsModuleActive(ENABLE__FU_ELC_ABILITY, FALSE))
    return;

  string sEvent = NWNX_Events_GetCurrentEvent();
  if (sEvent == "")
    SubscribeEvent(ON_PLAYER_ELC, __FILE__);
  else if (sEvent == ON_PLAYER_ELC)
    OnPlayerELC();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions