Hello,

We are actually trying to compile qpid-proton 0.12.0 on SunOS 5.10 x86 and some 
of qpid-proton's unitary tests are failing such as c-reactor-tests. After 
adding some logs and debugging, we have noticed that on SunOS events are not 
received by the reactor and thus nothing is added to the cache which results in 
a segmentation fault:

11: Assertion failed: field->clazz == clazz, file 
/src/new/rmourad/qpid-proton/proton-c/src/object/record.c, line 104, function 
pn_record_def
1/1 Test #11: c-reactor-tests ..................***Exception: SegFault  0.00 sec

Can you please assist?

Environment details
Type

Value

OS

SunOS Generic_142910-17 i86pc i386 i86pc

CMake

2.8.0

Python

2.7 (64-bit)

Command line

cmake .. -DCMAKE_C_COMPILER=cc -DCMAKE_CXX_COMPILER=CC 
-DPYTHON_EXECUTABLE=/path_to_python/bin/python -DCMAKE_C_FLAGS=" -m64 -xc99 
-lsocket" -DCMAKE_CXX_FLAGS=" -m64" -DCMAKE_BUILD_TYPE=RelWithDebInfo

make

ctest -V -R c-reactor-tests


The missing call on SunOS (Visual studio debugger)
[Description : cid:image002.jpg@01D16D92.74B29B10]

You can see in the below table which compares the logs that there are 2 keys 0 
and 917115589 for Windows but only the 0 for SunOS. I have attached the 
modified file where I added the logs (proton-c/src/object/record.c).

Linux/Windows

SunOS

Field with key 0 NOT found in cache 0x75a0a0
Field class set as: 0x602ee0:pn_void
Field with key 0 NOT found in cache 0x75abc0
Field class set as: 0x602ee0:pn_void
Field with key 0 NOT found in cache 0x75ac80
Field class set as: 0x602ee0:pn_void
Field with key 0 NOT found in cache 0x75ad20
Field class set as: 0x602ee0:pn_void
Setting field from cache
Field with key 0 found in cache 0x75ac80: 0x602ee0:pn_void
Field with key 917115590 NOT found in cache 0x75ac80
Field with key 0 NOT found in cache 0x75adc0
Field class set as: 0x602ee0:pn_void
Field with key 917115589 NOT found in cache 0x75abc0
Field class set as: 0x7f9336cae540:pn_object
Setting field from cache
Field with key 917115589 found in cache 0x75abc0: 0x7f9336cae540:pn_object
Getting field from cache
Field with key 917115589 found in cache 0x75abc0: 0x7f9336cae540:pn_object
Field with key 917115589 found in cache 0x75abc0: 0x7f9336cae540:pn_object
Asserting field class and provided class: 0x7f9336cae540:pn_object vs 
0x7f9336cae540:pn_object

Field with key 0 NOT found in cache 4136d0
Field class set as: 4135a0:pn_void
Field with key 0 NOT found in cache 413990
Field class set as: 4135a0:pn_void
Field with key 0 NOT found in cache 4139d0
Field class set as: 4135a0:pn_void
Field with key 0 NOT found in cache 413a10
Field class set as: 4135a0:pn_void
Setting field from cache
Field with key 0 found in cache 4139d0: 4135a0:pn_void
Field with key 0 found in cache 4139d0: 4135a0:pn_void
Field with key 0 found in cache 413990: 4135a0:pn_void
Asserting field class and provided class: 4135a0:pn_void vs 
fffffd7fff35f6a0:pn_object


Regards,

Adel Boutros
------------------
Murex SAS
8 rue Bellini
75016 Paris
[Description : Description : signature]

/*
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 */

#include <proton/object.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>

typedef struct {
  pn_handle_t key;
  const pn_class_t *clazz;
  void *value;
} pni_field_t;

struct pn_record_t {
  size_t size;
  size_t capacity;
  pni_field_t *fields;
};

static void pn_record_initialize(void *object)
{
  pn_record_t *record = (pn_record_t *) object;
  record->size = 0;
  record->capacity = 0;
  record->fields = NULL;
}

static void pn_record_finalize(void *object)
{
  pn_record_t *record = (pn_record_t *) object;
  for (size_t i = 0; i < record->size; i++) {
    pni_field_t *v = &record->fields[i];
    pn_class_decref(v->clazz, v->value);
  }
  free(record->fields);
}

#define pn_record_hashcode NULL
#define pn_record_compare NULL
#define pn_record_inspect NULL

pn_record_t *pn_record(void)
{
  static const pn_class_t clazz = PN_CLASS(pn_record);
  pn_record_t *record = (pn_record_t *) pn_class_new(&clazz, 
sizeof(pn_record_t));
  pn_record_def(record, PN_LEGCTX, PN_VOID);
  return record;
}

static pni_field_t *pni_record_find(pn_record_t *record, pn_handle_t key) {
  for (size_t i = 0; i < record->size; i++) {
    pni_field_t *field = &record->fields[i];
    if (field->key == key) {
       fprintf(stderr, " ===>>> Field with key %d found in cache %p: %p:%s\n", 
key, record, field->clazz, field->clazz->name);
      return field;
    }
  }

  fprintf(stderr, " ===>>> Field with key %d NOT found in cache %p\n", key, 
record);
  return NULL;
}

static pni_field_t *pni_record_create(pn_record_t *record) {
  record->size++;
  if (record->size > record->capacity) {
    record->fields = (pni_field_t *) realloc(record->fields, record->size * 
sizeof(pni_field_t));
    record->capacity = record->size;
  }
  pni_field_t *field = &record->fields[record->size - 1];
  field->key = 0;
  field->clazz = NULL;
  field->value = NULL;
  return field;
}

void pn_record_def(pn_record_t *record, pn_handle_t key, const pn_class_t 
*clazz)
{
  assert(record);
  assert(clazz);

  pni_field_t *field = pni_record_find(record, key);
  if (field) {
    fflush( stderr );
    fprintf(stderr, " ===>>> Asserting field class and provided class: %p:%s vs 
%p:%s\n", field->clazz, field->clazz->name, clazz, clazz->name);
    assert(field->clazz == clazz);
  } else {
    field = pni_record_create(record);
    field->key = key;
    field->clazz = clazz;
    fprintf(stderr, " ===>>> Field class set as: %p:%s\n", clazz, clazz->name);
    fflush(stderr);
  }
}

bool pn_record_has(pn_record_t *record, pn_handle_t key)
{
  assert(record);
  pni_field_t *field = pni_record_find(record, key);
  if (field) {
    return true;
  } else {
    return false;
  }
}

void *pn_record_get(pn_record_t *record, pn_handle_t key)
{
  assert(record);
  fprintf(stderr, " ===>>> Getting field from cache\n");
  pni_field_t *field = pni_record_find(record, key);
  if (field) {
    return field->value;
  } else {
    return NULL;
  }
}

void pn_record_set(pn_record_t *record, pn_handle_t key, void *value)
{
  assert(record);

  fprintf(stderr, " ===>>> Setting field from cache\n");
  pni_field_t *field = pni_record_find(record, key);
  if (field) {
    void *old = field->value;
    field->value = value;
    pn_class_incref(field->clazz, value);
    pn_class_decref(field->clazz, old);
  }
}

void pn_record_clear(pn_record_t *record)
{
  assert(record);
  for (size_t i = 0; i < record->size; i++) {
    pni_field_t *field = &record->fields[i];
    pn_class_decref(field->clazz, field->value);
    field->key = 0;
    field->clazz = NULL;
    field->value = NULL;
  }
  record->size = 0;
  pn_record_def(record, PN_LEGCTX, PN_VOID);
}

*******************************

This e-mail contains information for the intended recipient only. It may 
contain proprietary material or confidential information. If you are not the 
intended recipient you are not authorised to distribute, copy or use this 
e-mail or any attachment to it. Murex cannot guarantee that it is virus free 
and accepts no responsibility for any loss or damage arising from its use. If 
you have received this e-mail in error please notify immediately the sender and 
delete the original email received, any attachments and all copies from your 
system.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org
For additional commands, e-mail: users-h...@qpid.apache.org

Reply via email to