Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] Strange error message


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
nik.middleton at noble...
Guest





PostPosted: Tue Feb 10, 2009 4:07 pm    Post subject: [Freeswitch-users] Strange error message Reply with quote

Hi Guys,

I’m baffled by this error. I’m updating the db on call hang-up If I comment out curs:close() no error, but I’m concerned about memory leaks. Can anyone tell me what FS is complaining about?

The db gets updated in both cases

Regards



require "luasql.mysql"

function myHangupHook(s, status, arg)
freeswitch.consoleLog("info", " : They hung up on US!!!\n");
env = assert (luasql.mysql())
con = assert (env:connect("xxxxl","xxxxxxxxx","pass","192.168.3.205"))
curs = assert (con:execute"UPDATE callers SET lastcall = 'BOB' WHERE id = 33292")
curs:close()
con:close()
env:close()
freeswitch.consoleLog("NOTICE", "myHangupHook: " .. status .. "\n");
--error()
end




2009-02-10 20:53:20 [INFO] switch_cpp.cpp:1086 console_log() : They hung up on US!!!
2009-02-10 20:53:20 [ERR] mod_lua.cpp:176 lua_parse_and_execute() /usr/local/freeswitch/scripts/helloworld.lua:50: attempt to index global 'curs' (a number value)
stack traceback:
/usr/local/freeswitch/scripts/helloworld.lua:50: in function </usr/local/freeswitch/scripts/helloworld.lua:45>
[C]: in function 'hangup'
/usr/local/freeswitch/scripts/helloworld.lua:70: in main chunk
2009-02-10 20:53:20 [NOTICE] switch_core_session.c:957 switch_core_session_thread() Session 63 (sofia/internal/1001@192.168.3.206) Ended
Back to top
c_cav_01 at yahoo.com
Guest





PostPosted: Tue Feb 10, 2009 4:22 pm    Post subject: [Freeswitch-users] Strange error message Reply with quote

Closing the connection will force the server to close any open transactions, as well as release recordsets in local memory that reference the connection.

However curs is not a recordset. An SQL update is going to return an integer (rows affected) or boolean depending on the which server you use since no recordset is actually requested.

--- On Tue, 2/10/09, Nik Middleton <nik.middleton@noblesolutions.co.uk> wrote:

Quote:
From: Nik Middleton <nik.middleton@noblesolutions.co.uk>
Subject: [Freeswitch-users] Strange error message
To: freeswitch-users@lists.freeswitch.org
Date: Tuesday, February 10, 2009, 2:04 PM


Hi Guys,



I’m baffled by this error. I’m updating the db on call hang-up If I comment out curs:close() no error, but I’m concerned about memory leaks. Can anyone tell me what FS is complaining about?



The db gets updated in both cases



Regards







require "luasql.mysql"



function myHangupHook(s, status, arg)

freeswitch.consoleLog("info", " : They hung up on US!!!\n");

env = assert (luasql.mysql())

con = assert (env:connect("xxxxl","xxxxxxxxx","pass","192.168.3.205"))

curs = assert (con:execute"UPDATE callers SET lastcall = 'BOB' WHERE id = 33292")

curs:close()

con:close()

env:close()

freeswitch.consoleLog("NOTICE", "myHangupHook: " .. status .. "\n");

--error()

end









2009-02-10 20:53:20 [INFO] switch_cpp.cpp:1086 console_log() : They hung up on US!!!

2009-02-10 20:53:20 [ERR] mod_lua.cpp:176 lua_parse_and_execute() /usr/local/freeswitch/scripts/helloworld.lua:50: attempt to index global 'curs' (a number value)

stack traceback:

/usr/local/freeswitch/scripts/helloworld.lua:50: in function </usr/local/freeswitch/scripts/helloworld.lua:45>

[C]: in function 'hangup'

/usr/local/freeswitch/scripts/helloworld.lua:70: in main chunk

2009-02-10 20:53:20 [NOTICE] switch_core_session.c:957 switch_core_session_thread() Session 63 (sofia/internal/1001@192.168.3.206) Ended


Quote:
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Back to top
nik.middleton at noble...
Guest





PostPosted: Tue Feb 10, 2009 6:25 pm    Post subject: [Freeswitch-users] Strange error message Reply with quote

So what you’re saying is that I can comment out curs:close() as it’s not needed?

Regards,




From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Chris
Sent: 10 February 2009 21:19
To: freeswitch-users@lists.freeswitch.org
Subject: Re: [Freeswitch-users] Strange error message

Closing the connection will force the server to close any open transactions, as well as release recordsets in local memory that reference the connection.



However curs is not a recordset. An SQL update is going to return an integer (rows affected) or boolean depending on the which server you use since no recordset is actually requested.

--- On Tue, 2/10/09, Nik Middleton <nik.middleton@noblesolutions.co.uk> wrote:
Quote:

From: Nik Middleton <nik.middleton@noblesolutions.co.uk>
Subject: [Freeswitch-users] Strange error message
To: freeswitch-users@lists.freeswitch.org
Date: Tuesday, February 10, 2009, 2:04 PM
Hi Guys,



I’m baffled by this error. I’m updating the db on call hang-up If I comment out curs:close() no error, but I’m concerned about memory leaks. Can anyone tell me what FS is complaining about?


The db gets updated in both cases

Regards



require "luasql.mysql"

function myHangupHook(s, status, arg)
freeswitch.consoleLog("info", " : They hung up on US!!!\n");
env = assert (luasql.mysql())
con = assert (env:connect("xxxxl","xxxxxxxxx","pass","192.168.3.205"))
curs = assert (con:execute"UPDATE callers SET lastcall = 'BOB' WHERE id = 33292")
curs:close()
con:close()
env:close()
freeswitch.consoleLog("NOTICE", "myHangupHook: " .. status .. "\n");
--error()
end




2009-02-10 20:53:20 [INFO] switch_cpp.cpp:1086 console_log() : They hung up on US!!!
2009-02-10 20:53:20 [ERR] mod_lua.cpp:176 lua_parse_and_execute() /usr/local/freeswitch/scripts/helloworld.lua:50: attempt to index global 'curs' (a number value)
stack traceback:
/usr/local/freeswitch/scripts/helloworld.lua:50: in function </usr/local/freeswitch/scripts/helloworld.lua:45>
[C]: in function 'hangup'
/usr/local/freeswitch/scripts/helloworld.lua:70: in main chunk
2009-02-10 20:53:20 [NOTICE] switch_core_session.c:957 switch_core_session_thread() Session 63 (sofia/internal/1001@192.168.3.206) Ended
Quote:
_______________________________________________Freeswitch-users mailing listFreeswitch-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-usersUNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.freeswitch.org
Back to top
c_cav_01 at yahoo.com
Guest





PostPosted: Wed Feb 11, 2009 10:25 am    Post subject: [Freeswitch-users] Strange error message Reply with quote

In that particular instance, no, it's not needed. It's assigned a numeric value and is just a variable that will disappear when it goes out of scope. You could deallocate or release the variable if you wished to be tidy.

In the case of a recordset being returned by the server (an SQL "SELECT") then it will be a recordset object and would need to be closed.

If you look at your error, your trying to index a number. e.g curs assigned numeric by the UPDATE returning the number of rows affected, then your trying to look for a :close method or property on a numeric var which isn't going to work and the compiler is interpreting that as an attempt to index it.

In general, on most SQL servers, SQL insert, update and delete calls return numerics, only select returns recordsets.

--- On Tue, 2/10/09, Nik Middleton <nik.middleton@noblesolutions.co.uk> wrote:

Quote:
From: Nik Middleton <nik.middleton@noblesolutions.co.uk>
Subject: Re: [Freeswitch-users] Strange error message
To: freeswitch-users@lists.freeswitch.org
Date: Tuesday, February 10, 2009, 4:22 PM


So what you’re saying is that I can comment out curs:close() as it’s not needed?



Regards,








From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Chris
Sent: 10 February 2009 21:19
To: freeswitch-users@lists.freeswitch.org
Subject: Re: [Freeswitch-users] Strange error message



Closing the connection will force the server to close any open transactions, as well as release recordsets in local memory that reference the connection.





However curs is not a recordset. An SQL update is going to return an integer (rows affected) or boolean depending on the which server you use since no recordset is actually requested.

--- On Tue, 2/10/09, Nik Middleton <nik.middleton@noblesolutions.co.uk> wrote:

Quote:

From: Nik Middleton <nik.middleton@noblesolutions.co.uk>
Subject: [Freeswitch-users] Strange error message
To: freeswitch-users@lists.freeswitch.org
Date: Tuesday, February 10, 2009, 2:04 PM

Hi Guys,





I’m baffled by this error. I’m updating the db on call hang-up If I comment out curs:close() no error, but I’m concerned about memory leaks. Can anyone tell me what FS is complaining about?



The db gets updated in both cases



Regards







require "luasql.mysql"



function myHangupHook(s, status, arg)

freeswitch.consoleLog("info", " : They hung up on US!!!\n");

env = assert (luasql.mysql())

con = assert (env:connect("xxxxl","xxxxxxxxx","pass","192.168.3.205"))

curs = assert (con:execute"UPDATE callers SET lastcall = 'BOB' WHERE id = 33292")

curs:close()

con:close()

env:close()

freeswitch.consoleLog("NOTICE", "myHangupHook: " .. status .. "\n");

--error()

end









2009-02-10 20:53:20 [INFO] switch_cpp.cpp:1086 console_log() : They hung up on US!!!

2009-02-10 20:53:20 [ERR] mod_lua.cpp:176 lua_parse_and_execute() /usr/local/freeswitch/scripts/helloworld.lua:50: attempt to index global 'curs' (a number value)

stack traceback:

/usr/local/freeswitch/scripts/helloworld.lua:50: in function </usr/local/freeswitch/scripts/helloworld.lua:45>

[C]: in function 'hangup'

/usr/local/freeswitch/scripts/helloworld.lua:70: in main chunk

2009-02-10 20:53:20 [NOTICE] switch_core_session.c:957 switch_core_session_thread() Session 63 (sofia/internal/1001@192.168.3.206) Ended
Quote:
_______________________________________________Freeswitch-users mailing listFreeswitch-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-usersUNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.freeswitch.org




Quote:
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services