riaken / riaken-core

Go Protocol Buffer driver for the Riak distributed database
Other
31 stars 7 forks source link

Riaken does not clean up after creating crdts in a session #5

Closed bfosberry closed 9 years ago

bfosberry commented 9 years ago

I am seeing a weird issue and as best as I can tell, riaken is not commiting something related to crdts. Sessions work create for generic operations, however when it comes to crdts, as soon as I release a session, my cluster gets hosed:

package main

import (
  riaken "github.com/riaken/riaken-core"

    "fmt"
)

func main() {
    var err error

    riakClient := riaken_core.NewClient(MYHOSTS)

    if err = riakClient.Dial(); err != nil {
        fmt.Println("failed to dial")
    }

  for i := 0; i < 10; i++ {
        var bucketAName string = "test_bucket_1"
        session := riakClient.Session()
        bucketA := session.GetBucket(bucketAName).Type("sets") //sets is a sets bucket type

        setCrdtName := "test_set"
        crdtA := bucketA.Crdt(setCrdtName)
    var s *riaken.CrdtSet
    if i ==0 {
      s = crdtA.NewSet()
    } else {
      s = crdtA.Set
    }
        fmt.Println(s)
        s.Add("foop")
        if _, err := s.Commit(); err != nil {
            fmt.Println(err)
        }
        fmt.Println(s.Values)
    session.Release()

    session = riakClient.Session()

    var bucketBName string = "test_bucket_2"
    bucketB := session.GetBucket(bucketBName).Type("maps") //maps is a maps bucket type
        mapCrdtName := "test_map"

        crdtB := bucketB.Crdt(mapCrdtName)
    var m *riaken.CrdtMap
    if i ==0 {
      m = crdtB.NewMap()
    } else {
      m = crdtB.Map
    }
        fmt.Println(m)
        m.Registers["foor"] = "barrr"
        if _, err := m.Commit(); err != nil {
            fmt.Println(err)
        }
        fmt.Println(m.Registers["foor"])
    session.Release()

    }
    riakClient.Close()
}

I'd expect to see the set and map get created, and then either expanded, or not, or a conflict error raised of some kind. What actually happens is as soon as the first session is released, the, client blocks indefinitely.

bfosberry commented 9 years ago

Seeing some weird stuff, unsure if it's my local riak setup or if its an issue with crdts:

Managing to trigger an erlang crash in riak though :(

2014-11-24 23:40:19 =CRASH REPORT====
  crasher:
    initial call: mochiweb_acceptor:init/3
    pid: <0.2735.0>
    registered_name: []
    exception error: {{case_clause,{ok,{http_error,[0,0,0,44,82,10]},<<>>}},[{mochiweb_http,request,3,[{file,"src/mochiweb_http.erl"},{line,107}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}
    ancestors: ['http://0.0.0.0:8098_mochiweb',riak_api_sup,<0.280.0>]
    messages: []
    links: [<0.287.0>,#Port<0.15109>]
    dictionary: []
    trap_exit: false
    status: running
    heap_size: 376
    stack_size: 27
    reductions: 11582
  neighbours:
2014-11-24 23:40:19 =CRASH REPORT====
  crasher:
    initial call: mochiweb_acceptor:init/3
    pid: <0.6413.0>
    registered_name: []
    exception error: {{case_clause,{ok,{http_error,[0,0,0,32,80,10]},<<>>}},[{mochiweb_http,request,3,[{file,"src/mochiweb_http.erl"},{line,107}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}
    ancestors: ['http://0.0.0.0:8098_mochiweb',riak_api_sup,<0.280.0>]
    messages: []
    links: [<0.287.0>,#Port<0.15110>]
    dictionary: []
    trap_exit: false
    status: running
    heap_size: 376
    stack_size: 27
    reductions: 1755
  neighbours:
boj commented 9 years ago

@bfosberry Can you verify that all the riaken-core tests minus 1.4 Search run against your environment?

bfosberry commented 9 years ago

Will check that, we are testing locally to try and provide a better overview of what the issue is. We've noticed that if an error is returned from a session, the session is closed, which may or may not be intentional

bfosberry commented 9 years ago

Can't replicate...everything just works now, I'll reopen this if I manage to replicate

bfosberry commented 9 years ago

Yeah, I think this was an issue with the riak cluster