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

LockExclusive crash #20

Closed
arthurtsang opened this issue May 18, 2016 · 7 comments
Closed

LockExclusive crash #20

arthurtsang opened this issue May 18, 2016 · 7 comments

Comments

@arthurtsang
Copy link

arthurtsang commented May 18, 2016

I'm using rbd-docker-plugin and it crashed when calling LockExclusive.

here's my env,

CentOS 7.2 with kernel 4.5.3-1.el7.elrepo.x86_64,
ceph version 10.2.1 (3a66dd4f30852819c1bdaa8ec23c795d4ad77269)
librados2 & librbd1 1:10.2.1-0.el7

I couldn't see any relevant log messages, in dmesg, i see this usually (it didn't crash if the image is already lock and return a error message that says it can't get the exclusive lock)

[499439.546891] libceph: client14394 fsid bdce5816-e19c-4aac-b6e9-c694920dc9e7
[499439.552582] libceph: mon0 10.10.131.54:6789 session established
[499439.569701] rbd: rbd0: added with size 0x500000
[499439.693347] rbd: rbd1: added with size 0x500000

however when it crash, there's no such messages in the dmesg.

btw, the lock is created and locking an image using rdb command directly works fine.

@tdsparrow
Copy link

This issue only affect ceph after infernalis, which should be caused by librbd code change.
rbd_open didn't initialize image_wacher for ImageCtx. Later ImageCtx::notify_update uses the pointer and cause segfault.

tdsparrow added a commit to tdsparrow/ceph that referenced this issue Jun 13, 2016
  rbd_open didn't initialize image_wathcer which will be used later for notification.
  It will cause go-ceph client crash.

Signed-off-by: tdsparrow <sqallowlee@gmail.com>
tdsparrow added a commit to tdsparrow/ceph that referenced this issue Jun 13, 2016
  rbd_open didn't initialize image_wathcer which will be used later for notification.
  It will cause go-ceph client crash.

Signed-off-by: Ren Li <sqallowlee@gmail.com>
@dotnwat
Copy link
Contributor

dotnwat commented Jun 14, 2016

I'm trying to get caught up on go-ceph issues, sorry about the delay. Do I understand correctly that the code works ok before infernalis and is broken after infernalis?

@dotnwat
Copy link
Contributor

dotnwat commented Jun 14, 2016

how hard would it be to provide a code snipper that reproduces the problem?

@arthurtsang
Copy link
Author

arthurtsang commented Jun 14, 2016

oh, i'm just using rdb-docker-plugin. didn't actually write the code.
and yes, it works with older version of cepth

@david-z
Copy link
Member

david-z commented Jun 17, 2016

@noahdesu you are right, this issue won't happen on hammer at least. I also met this issue when using rbd-docker-plugin on recent jewel release. I just made some comments on ceph/ceph#9660 and hope to fix this issue soon.

If you would like to reproduce it, here is a golang code snippet, but pls ensure rbd image is existed before you run this code.

package main

import (
        "github.com/ceph/go-ceph/rbd"
        "github.com/ceph/go-ceph/rados"
        "fmt"
)

func main() {
        fmt.Printf("test_librbd\n")

        conn, _ := rados.NewConn()
        conn.ReadDefaultConfigFile()
        conn.Connect()

        poolname := "rbd"
        ioctx, err := conn.OpenIOContext(poolname)
        if err != nil {
                fmt.Printf("open pool fails: %s\n", err)
                return
        }

        // ensure rbd image is existed already
        imagename := "rbd_image_1"
        img := rbd.GetImage(ioctx, imagename)

        err = img.Open(true)
        if err != nil {
                fmt.Printf("fail to open image: %s\n", err)
                return
        }
        defer img.Close()

        locker := "test_lock"
        err = img.LockExclusive(locker)
        if err != nil {
                fmt.Printf("fail to lock image: %s\n", err)
                return
        }
        fmt.Printf("lock done\n")

        err = img.Unlock(locker)
        if err != nil {
                fmt.Printf("fail to unlock image: %s\n", err)
                return
        }
        fmt.Printf("unlock done\n")
}

@dotnwat
Copy link
Contributor

dotnwat commented Jun 17, 2016

Perfect, thanks. That will make things much easier!

@phlogistonjohn
Copy link
Collaborator

Hello, I'm automatically closing all issues filed prior to 2018 that have not been commented on recently. If this issue is still relevant to you please reopen the issue and restart the discussion. Thank you for your understanding.

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

Successfully merging a pull request may close this issue.

5 participants