Code Monkey home page Code Monkey logo

Comments (4)

BrianNichols avatar BrianNichols commented on August 23, 2024

The as_monitor calls in ev_loop.txt are not necessary and cause the program to hang because as_monitor_notify() is never called. After removing all as_monitor calls, the program runs to completion:

e = 0x7fdb03403930 loop = 0x7fdb03403a00, next = 0x7fdb03403930 c = 0x7fdb03403930

I could never get the program to segfault.

from aerospike-client-c.

prasad-joshi avatar prasad-joshi commented on August 23, 2024

Thanks a lot for immediate response. Sorry I did not share details about my development environment.

Here are the details

# lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.1 LTS
Release:	16.04
Codename:	xenial

# dpkg -l | grep -i aero
ii  aerospike-client-c-libev-devel    4.1.2    amd64    Aerospike Client Development with libev

Like you suggested, removed as_monitor code.

# gcc -o ev_loop ev_loop.c -ggdb -laerospike -lssl -lcrypto -lpthread -lm -lz -lev

# ulimit -c unlimited

# ./ev_loop 192.168.2.14
e = 0x1783030 loop = 0x1784100, next = 0x1 c = 0x1783030
Segmentation fault (core dumped)

# ls core
core

Debugging core file shows link list is corrupt

root@ubuntu-template:~/sources# gdb ./ev_loop core
...
...
(gdb) bt
#0  0x0000000000402af7 in as_event_loop_get () at /usr/include/aerospike/as_event.h:223
#1  0x0000000000402e36 in main (argc=2, argv=0x7ffc4d9fa908) at ev_loop.c:100

(gdb) frame 0
#0  0x0000000000402af7 in as_event_loop_get () at /usr/include/aerospike/as_event.h:223
223		as_event_loop_current = event_loop->next;

(gdb) print event_loop
$1 = (as_event_loop *) 0x1

(gdb) print as_event_loops[0]
$2 = {loop = 0x1784100, next = 0x1, lock = {__data = {__lock = 0, __count = 0, __owner = 24653872, __nusers = 0, __kind = 204278650, __spins = 32516, 
      __elision = 0, __list = {__prev = 0x0, __next = 0x1783030}}, 
    __size = "\000\000\000\000\000\000\000\000\060\060x\001\000\000\000\000z\v-\f\004\177\000\000\000\000\000\000\000\000\000\000\060\060x\001\000\000\000", 
    __align = 0}, queue = {data = 0x0, capacity = 0, head = 0, tail = 0, item_size = 0, total = 0, flags = 0}, pipe_cb_queue = {data = 0x0, capacity = 24660032, 
    head = 0, tail = 256, item_size = 0, total = 0, flags = 8}, thread = 4294967296, index = 24654064, pipe_cb_calling = false}

(gdb) print i
$1 = 1  <<<< first as_event_loop_get() was successful.

Uploading complete code, executable, and core file.
aero-client.zip

Could this be problem with 4.1.2 version of the lib? Shall I use library from latest master instead? Please let me know if you need more information from my side.

Thanks and Regards,
Prasad

from aerospike-client-c.

BrianNichols avatar BrianNichols commented on August 23, 2024

I found the problem. AS_USE_LIBEV must be defined when compiling ev_loop.c.

gcc -DAS_USE_LIBEV -o ev_loop ev_loop.c -ggdb -laerospike -lssl -lcrypto -lpthread -lm -lz -lev

Otherwise, as_event_loop would have a different definition in your program compared with the compiled libaerospike.

from aerospike-client-c.

prasad-joshi avatar prasad-joshi commented on August 23, 2024

Yes indeed defining AS_USE_LIBEV works perfectly. Thanks a lot for your time. Closing the case.

from aerospike-client-c.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.