Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I check existence of an object? #22

Open
czheo opened this issue May 16, 2017 · 10 comments
Open

How can I check existence of an object? #22

czheo opened this issue May 16, 2017 · 10 comments

Comments

@czheo
Copy link

czheo commented May 16, 2017

I tried stat() on a non-existing object and I got a segfault. Do I have any way to check the existence of an object with this binding?

@czheo czheo changed the title Can I check existence of an object? How can I check existence of an object? May 16, 2017
@dotnwat
Copy link
Owner

dotnwat commented May 16, 2017

That's a bug. Thanks for reporting. I'll have a fix soon.

@czheo
Copy link
Author

czheo commented May 16, 2017

Just a supplemental report: it seems the behavior of stat() is not deterministic. Sometimes it raises an unknown error(can be caught by lua) and sometimes it throws segment fault.

@dotnwat
Copy link
Owner

dotnwat commented May 16, 2017

do you have a minimal example of a script that will reproduce the error?

@czheo
Copy link
Author

czheo commented May 16, 2017

-- test.lua
rados = require 'rados'

cluster = rados.create()
cluster:conf_read_file()
cluster:connect()
ioctx = cluster:open_ioctx('test_pool')

print(ioctx:stat('test_obj'))

After several runs of the script, a segfault occurs as below. Sometimes, the segfault happens more often.
image

@dotnwat
Copy link
Owner

dotnwat commented May 16, 2017 via email

@czheo
Copy link
Author

czheo commented May 16, 2017

image

@dotnwat
Copy link
Owner

dotnwat commented May 17, 2017

I'm testing with an older version of Ceph and the same verison of Lua, and I can't reproduce the error. I'll try with a newer version of Ceph soon. Would you be able to run this under GDB to get a back trace, or send me a core dump after the segfault?

@czheo
Copy link
Author

czheo commented May 17, 2017

Here is the back trace generated from the core dump. It seems this is not caused by the stat() function but the close operation on ioctx.

(gdb) core core
warning: core file may not match specified executable file.
[New LWP 8150]
[New LWP 8151]
[New LWP 8155]
[New LWP 8153]
[New LWP 8152]
[New LWP 8160]
[New LWP 8159]
[New LWP 8158]
[New LWP 8156]
[New LWP 8154]
[New LWP 8157]
[New LWP 8163]
[New LWP 8162]
[New LWP 8161]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `lua test.lua'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f7a87c4b14c in librados::IoCtx::close() () from /usr/lib/librados.so.2
[Current thread is 1 (Thread 0x7f7a9166d700 (LWP 8150))]

(gdb) bt full
#0  0x00007fb70f31e14c in librados::IoCtx::close() () from /usr/lib/librados.so.2
No symbol table info available.
#1  0x00007fb70f31f025 in librados::Rados::ioctx_create(char const*, librados::IoCtx&) () from /usr/lib/librados.so.2
No symbol table info available.
#2  0x00007fb717bdf3a7 in lrad_open_ioctx (L=0x1f9a010) at lua_rados.cc:301
        cluster = 0x1fa2218
        pool_name = 0x1fa3838 "test_pool"
        ioctx = 0x20dc898
        ret = <optimized out>
#3  0x00000000004080e0 in luaD_precall (L=L@entry=0x1f9a010, func=func@entry=0x1f9a420, nresults=nresults@entry=1) at ldo.c:320
        ci = <optimized out>
        n = <optimized out>
        cl = <optimized out>
        funcr = <optimized out>
#4  0x00000000004116e2 in luaV_execute (L=L@entry=0x1f9a010, nexeccalls=nexeccalls@entry=1) at lvm.c:591
        b = <optimized out>
        nresults = 1
        i = <optimized out>
        ra = 0x1f9a420
        cl = 0x1fa3ba0
        base = <optimized out>
        k = 0x1fa3650
        pc = 0x1fa3558
#5  0x000000000040853d in luaD_call (L=0x1f9a010, func=0x1f9a410, nResults=<optimized out>) at ldo.c:378
No locals.
#6  0x000000000040782b in luaD_rawrunprotected (L=L@entry=0x1f9a010, f=f@entry=0x404950 <f_call>, ud=ud@entry=0x7ffed5767f60)
    at ldo.c:116
        lj = {previous = 0x7ffed57680e0, b = {{__jmpbuf = {33136656, -7142391443340622946, 0, 1, 1, 33137280,
                7141734621551821726, -7142388360951594082}, __mask_was_saved = 0, __saved_mask = {__val = {
                  0 <repeats 13 times>, 268435456, 7795503554532172149, 8299690376036639087}}}}, status = 0}
#7  0x000000000040869b in luaD_pcall (L=L@entry=0x1f9a010, func=func@entry=0x404950 <f_call>, u=u@entry=0x7ffed5767f60,
    old_top=64, ef=<optimized out>) at ldo.c:464
---Type <return> to continue, or q <return> to quit---
        status = <optimized out>
        oldnCcalls = 1
        old_ci = 40
        old_allowhooks = 1 '\001'
        old_errfunc = 0
#8  0x0000000000405d26 in lua_pcall (L=L@entry=0x1f9a010, nargs=nargs@entry=0, nresults=-1, errfunc=errfunc@entry=2)
    at lapi.c:821
        c = {func = 0x1f9a410, nresults = -1}
        status = <optimized out>
        func = <optimized out>
#9  0x0000000000403ecc in docall (L=0x1f9a010, narg=0, clear=0) at lua.c:102
        status = <optimized out>
        base = 2
#10 0x00000000004048a9 in handle_script (n=<optimized out>, argv=<optimized out>, L=<optimized out>) at lua.c:250
        status = 0
        fname = <optimized out>
#11 pmain (L=0x1f9a010) at lua.c:362
        s = 0x7ffed5768250
        argv = <optimized out>
        has_i = <optimized out>
        has_v = <optimized out>
        has_e = <optimized out>
#12 0x00000000004080e0 in luaD_precall (L=L@entry=0x1f9a010, func=func@entry=0x1f9a3e0, nresults=0) at ldo.c:320
        ci = <optimized out>
        n = <optimized out>
        cl = <optimized out>
        funcr = <optimized out>
#13 0x00000000004084f4 in luaD_call (L=0x1f9a010, func=0x1f9a3e0, nResults=<optimized out>) at ldo.c:377
No locals.
#14 0x000000000040782b in luaD_rawrunprotected (L=L@entry=0x1f9a010, f=f@entry=0x404960 <f_Ccall>, ud=ud@entry=0x7ffed5768220)
    at ldo.c:116
        lj = {previous = 0x0, b = {{__jmpbuf = {33136656, -7142391443343768674, 0, 1, 0, 33137280, 7141734623741248414,
---Type <return> to continue, or q <return> to quit---
                -7142388360951594082}, __mask_was_saved = 0, __saved_mask = {__val = {0, 33136656, 11304355161124930462,
                  4269024, 140732479734624, 0, 0, 7141734623797871518, 11304355712757957534, 0, 0, 4269024, 616, 0, 0,
                  140424358989119}}}}, status = 0}
#15 0x000000000040869b in luaD_pcall (L=L@entry=0x1f9a010, func=func@entry=0x404960 <f_Ccall>, u=u@entry=0x7ffed5768220,
    old_top=16, ef=ef@entry=0) at ldo.c:464
        status = <optimized out>
        oldnCcalls = 0
        old_ci = 0
        old_allowhooks = 1 '\001'
        old_errfunc = 0
#16 0x0000000000405db5 in lua_cpcall (L=L@entry=0x1f9a010, func=func@entry=0x404380 <pmain>, ud=ud@entry=0x7ffed5768250)
    at lapi.c:856
        c = {func = 0x404380 <pmain>, ud = 0x7ffed5768250}
        status = <optimized out>
#17 0x0000000000403b94 in main (argc=2, argv=0x7ffed5768368) at lua.c:387
        status = <optimized out>
        s = {argc = 2, argv = 0x7ffed5768368, status = 0}
        L = 0x1f9a010

@dotnwat
Copy link
Owner

dotnwat commented May 18, 2017

is it possible that you are running lua-rados with a version of rados that is different than the one you compiled with?

@czheo
Copy link
Author

czheo commented Jun 1, 2017

I am running using this docker image: https://hub.docker.com/r/ceph/demo/

It seems librados-dev and ceph are both 11.2.0

[14:46:36][root@ed924ffed822][~] 6 files
:) apt-get install librados-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
librados-dev is already the newest version (11.2.0-1xenial).
0 upgraded, 0 newly installed, 0 to remove and 18 not upgraded.

[14:46:40][root@ed924ffed822][~] 6 files
:) ceph -v
ceph version 11.2.0 (f223e27eeb35991352ebc1f67423d4ebc252adb7)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants