moai / luamongo

Lua driver for mongodb
https://github.com/moai/luamongo
MIT License
170 stars 58 forks source link

629b687 seems to hang on db:connect #18

Closed waitman closed 10 years ago

waitman commented 12 years ago
Hi,

Troubleshooting new install, seems to hang on connect
moai-luamongo-629b687

# uname -a
FreeBSD hunny.waitman.net 10.0-CURRENT FreeBSD 10.0-CURRENT #1: Mon Mar 26 19:48:52 PDT 2012
     waitman@hunny.waitman.net:/usr/obj/usr/src/sys/KEYSHIA  amd64

# ldd /usr/local/lib/lua/5.1/mongo.so 
/usr/local/lib/lua/5.1/mongo.so:
    libboost_thread.so => /usr/local/lib/libboost_thread.so (0x801343000)
    libboost_filesystem.so => /usr/local/lib/libboost_filesystem.so (0x80155b000)
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x801783000)
    libm.so.5 => /lib/libm.so.5 (0x801a93000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x801cb6000)
    libc.so.7 => /lib/libc.so.7 (0x80081b000)
    libthr.so.3 => /lib/libthr.so.3 (0x801ec3000)
    libboost_system.so => /usr/local/lib/libboost_system.so (0x8020e6000)

# mongo --version
MongoDB shell version: 2.0.4
# mongod --version
db version v2.0.4, pdfile version 4.5
Tue Apr 10 22:54:05 git version: nogitversion

# lua -v 
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio

# g++ -v
Using built-in specs.
Target: amd64-undermydesk-freebsd
Configured with: FreeBSD/amd64 system compiler
Thread model: posix
gcc version 4.2.1 20070831 patched [FreeBSD]

running a c++ test connects OK

ie,

#include <iostream>
#include "client/dbclient.h"

using namespace mongo;

void run() {
  DBClientConnection c;
  c.connect("localhost");
}

int main() {
  try {
    run();

g++ -g -O2 -fPIC testclient.cpp -I/usr/local/include/ 
    -I/usr/home/waitman/downloads/mongodb-src-r2.0.4/ 
    -L/usr/local/lib/ -lmongoclient -lboost_thread -lboost_filesystem

test client connects OK

# show log
Tue Apr 10 22:39:00 [initandlisten] connection accepted from 127.0.0.1:20154 #7
Tue Apr 10 22:39:00 [conn7] end connection 127.0.0.1:20154

but running the lua test hangs on connect (possibly forever but haven't waited that long). no errors/core etc 

require('mongo')
print ("1")
local db = assert(mongo.Connection.New())
print ("2")
assert(db:connect('127.0.0.1'))
print ("3")

never gets to 3. :(

Any help or suggestions much appreciated, thanks!

Waitman Gobble
San Jose California USA
waitman commented 12 years ago
trying tests/connection.lua

added 2 lines -- print status:

function test_ReplicaSet()
    -- Create a Connection object
    local db = mongo.Connection.New()
    assertNotNil( db, 'unable to create mongo.Connection' )
        print ("connection object created")

    assert( db:connect(test_server), 'unable to forcefully connect to mongo instance' )
        print ("connected OK")

# tests/connection.lua 
==============================================================================
LUAMONGO_TEST_CONNECTION
==============================================================================
test_ReplicaSet: .connection object created

.....

sits forever (well longest i've waited is 20 minutes), no error or no 'connected OK'

hitting 'control-C' stops it (have to do it twice)
larubbio commented 12 years ago

Can you let me know more about your setup? We're using this in production on an ubuntu server, so we obviously aren't seeing this issue. :)

waitman commented 12 years ago

sure, it's on a freebsd 10.0-CURRENT machine (amd64 smp out-of-order processors).

The C driver works fine (see example code) however the Lua wrapper hangs. my OP shows the versions of os/software...

i will update things forward and give it another try. thanks!