Show
Ignore:
Timestamp:
21.03.2012 20:05:50 (8 years ago)
Author:
ak19
Message:

GS3 tomcat server crashes because java crashes owing to some error in the JNI code. The error may be related to pointers having been stored as int rather than long, an issue that's become noticeable on 64 bit linux machines. Changes have been made in the JNI code where these pointers that are transferred between Java and C++ code are stored (GetIntField? and SetIntField? to GetLongField? and SetLongField?, as well as declaration of data_ptr as jlong not jint). Committing code first without debug statements so the commits can easily be done separately.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/common-src/indexers/mg/jni/MGSearchWrapperImpl.c

    r25147 r25244  
    142142 
    143143  /* Save the object on the Java side */ 
    144   (*j_env)->SetIntField(j_env, j_obj, FID_mg_data, (long) data); 
     144  (*j_env)->SetLongField(j_env, j_obj, FID_mg_data, (long) data); 
    145145 
    146146  /* Initialise MG environment variables */ 
     
    252252                      jstring j_query) 
    253253{ 
    254   MGWrapperData* data = (MGWrapperData*) (*j_env)->GetIntField(j_env, j_obj, FID_mg_data); 
     254  MGWrapperData* data = (MGWrapperData*) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data); 
    255255 
    256256  char* index_path; 
     
    517517                     jboolean j_on) 
    518518{ 
    519   MGWrapperData* data = (MGWrapperData*) (*j_env)->GetIntField(j_env, j_obj, FID_mg_data); 
     519  MGWrapperData* data = (MGWrapperData*) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data); 
    520520 
    521521  if (j_on) { 
     
    532532                     jboolean j_on) 
    533533{ 
    534   MGWrapperData* data = (MGWrapperData*) (*j_env)->GetIntField(j_env, j_obj, FID_mg_data); 
     534  MGWrapperData* data = (MGWrapperData*) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data); 
    535535 
    536536  if (j_on) { 
     
    547547                        jint j_max) 
    548548{ 
    549   MGWrapperData* data = (MGWrapperData*) (*j_env)->GetIntField(j_env, j_obj, FID_mg_data); 
     549  MGWrapperData* data = (MGWrapperData*) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data); 
    550550  data->queryInfo->maxDocs = j_max; 
    551551} 
     
    570570                        jboolean j_on) 
    571571{ 
    572   MGWrapperData* data = (MGWrapperData*) (*j_env)->GetIntField(j_env, j_obj, FID_mg_data); 
     572  MGWrapperData* data = (MGWrapperData*) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data); 
    573573  data->queryInfo->needTermFreqs = j_on; 
    574574} 
     
    580580                      jstring j_index) 
    581581{ 
    582   MGWrapperData* data = (MGWrapperData*) (*j_env)->GetIntField(j_env, j_obj, FID_mg_data); 
     582  MGWrapperData* data = (MGWrapperData*) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data); 
    583583 
    584584  /* Get the index name as a C string */ 
     
    606606                          jint j_mode) 
    607607{ 
    608   MGWrapperData* data = (MGWrapperData*) (*j_env)->GetIntField(j_env, j_obj, FID_mg_data); 
     608  MGWrapperData* data = (MGWrapperData*) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data); 
    609609  data->defaultBoolCombine = j_mode; 
    610610} 
     
    615615Java_org_greenstone_mg_MGSearchWrapper_getQueryParams(JNIEnv *j_env, jobject j_obj) 
    616616{ 
    617   MGWrapperData* data = (MGWrapperData*) (*j_env)->GetIntField(j_env, j_obj, FID_mg_data); 
     617  MGWrapperData* data = (MGWrapperData*) (*j_env)->GetLongField(j_env, j_obj, FID_mg_data); 
    618618  char result[512];  /* Assume this is big enough */ 
    619619