aaron3481 / assql

Automatically exported from code.google.com/p/assql
0 stars 0 forks source link

Unexpected Connection Close #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Re Issue #10 conversation. This seems to be unrelated to Responders and may
be an issue.

Info:
[ALL] com.maclema.mysql::Connection                : Set Data Handler To: 
com.maclema.mysql::HandshakeHandler
[ALL] com.maclema.mysql::Connection                : Socket Connected
[ALL] com.maclema.mysql::Connection                : Socket Data (65 bytes)
[ALL] com.maclema.mysql::HandshakeHandler          : Push Packet (Total
Packets: 0)
[ALL] com.maclema.mysql::HandshakeHandler          : Server Information Packet
[ALL] com.maclema.mysql::HandshakeHandler          : Next Packet
[ALL] com.maclema.mysql::ServerInformation         : Version: 5.0.37-standard
[ALL] com.maclema.mysql::HandshakeHandler          : doHandshake
[ALL] com.maclema.mysql::HandshakeHandler          : doSecureAuthentication
[ALL] com.maclema.mysql::Connection                : Socket Data (11 bytes)
[ALL] com.maclema.mysql::HandshakeHandler          : Push Packet (Total
Packets: 0)
[ALL] com.maclema.mysql::HandshakeHandler          : Next Packet
[ALL] com.maclema.mysql::HandshakeHandler          : Success Packet
[ALL] com.maclema.mysql::Connection                : Change Database 
(codeit_airlive_rentajewel)
[ALL] com.maclema.mysql::Connection                : Socket Data (11 bytes)
[ALL] com.maclema.mysql::HandshakeHandler          : Push Packet (Total
Packets: 0)
[ALL] com.maclema.mysql::HandshakeHandler          : Next Packet
[ALL] com.maclema.mysql::HandshakeHandler          : Connect With DB
Success Packet
[ALL] com.maclema.mysql::Connection                : Unregistered Data Handler
[ALL] com.maclema.mysql::Connection                : Connected
[ALL] com.maclema.mysql::Statement                 : executeQuery
[ALL] com.maclema.mysql::Statement                 : executing a regular
statement
[ALL] com.maclema.mysql::Connection                : Execute Query (update
revision 
set revision = revision+1, lastupdate=now())
[ALL] com.maclema.mysql::Connection                : Set Data Handler To: 
com.maclema.mysql::QueryHandler
[ALL] com.maclema.mysql::Statement                 : executeQuery
[ALL] com.maclema.mysql::Statement                 : executing a regular
statement
[ALL] com.maclema.mysql::Connection                : Execute Query (select
revision 
from revision)
[ALL] com.maclema.mysql::Connection                : Set Data Handler To: 
com.maclema.mysql::QueryHandler
[ALL] com.maclema.mysql::Connection                : Disconnected

Original issue reported on code.google.com by macl...@gmail.com on 15 May 2008 at 3:11

GoogleCodeExporter commented 9 years ago
I managed to reproduce this issue.

Do you call disconnect() directly after st.executeQuery()?

Example:

var st:Statement = con.createStatement();
st.executeQuery("select fileID from files", new MySqlResponser(
    function (e:MySqlEvent):void 
    {
        var rs:ResultSet = e.resultSet;
        Alert.show("Returned: " + rs.size() + " Files!");
    },
    function (e:MySqlErrorEvent):void
    {
        trace("Error: " + e.text);
        Alert.show("Error: " + e.text);
    }
));

// this is bad, it closes the connection before the query is 
// finished executing, disconnect() should be put inside one
// of the responders to ensure the query executes completely 
// before closing the socket.
con.disconnect();

Original comment by macl...@gmail.com on 15 May 2008 at 3:21

GoogleCodeExporter commented 9 years ago
If you checkout the Connection class from svn, I have added logic to check for a
premature disconnect() call.

Original comment by macl...@gmail.com on 15 May 2008 at 3:25

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[ALL] com.maclema.mysql::Connection                : connect()
[ALL] com.maclema.mysql::Connection                : Set Data Handler To: 
com.maclema.mysql::HandshakeHandler
[ALL] com.maclema.mysql::Connection                : Socket Connected
[ALL] com.maclema.mysql::Connection                : Socket Data (65 bytes)
[ALL] com.maclema.mysql::HandshakeHandler          : Push Packet (Total 
Packets: 0)
[ALL] com.maclema.mysql::HandshakeHandler          : Server Information Packet
[ALL] com.maclema.mysql::HandshakeHandler          : Next Packet
[ALL] com.maclema.mysql::ServerInformation         : Version: 5.0.37-standard
[ALL] com.maclema.mysql::HandshakeHandler          : doHandshake
[ALL] com.maclema.mysql::HandshakeHandler          : doSecureAuthentication
[ALL] com.maclema.mysql::Connection                : Socket Data (11 bytes)
[ALL] com.maclema.mysql::HandshakeHandler          : Push Packet (Total 
Packets: 0)
[ALL] com.maclema.mysql::HandshakeHandler          : Next Packet
[ALL] com.maclema.mysql::HandshakeHandler          : Success Packet
[ALL] com.maclema.mysql::Connection                : Change Database 
(codeit_airlive_rentajewel)
[ALL] com.maclema.mysql::Connection                : Send Command (Command: 2 
Data: 
codeit_airlive_rentajewel)
[ALL] com.maclema.mysql::Connection                : Socket Data (11 bytes)
[ALL] com.maclema.mysql::HandshakeHandler          : Push Packet (Total 
Packets: 0)
[ALL] com.maclema.mysql::HandshakeHandler          : Next Packet
[ALL] com.maclema.mysql::HandshakeHandler          : Connect With DB Success 
Packet
[ALL] com.maclema.mysql::Connection                : Unregistered Data Handler
[ALL] com.maclema.mysql::Connection                : Connected
[ALL] com.maclema.mysql::Statement                 : executeQuery
[ALL] com.maclema.mysql::Statement                 : executing a regular 
statement
[ALL] com.maclema.mysql::Connection                : Execute Query (update 
revision 
set revision = revision+1, lastupdate=now())
[ALL] com.maclema.mysql::Connection                : Set Data Handler To: 
com.maclema.mysql::QueryHandler
[ALL] com.maclema.mysql::Connection                : Send Command (Command: 3 
Data: 
update revision set revision = revision+1, lastupdate=now())
[ALL] com.maclema.mysql::Statement                 : executeQuery
[ALL] com.maclema.mysql::Statement                 : executing a regular 
statement
[ALL] com.maclema.mysql::Connection                : Execute Query (select 
revision 
from revision)
[ALL] com.maclema.mysql::Connection                : Unregistered Data Handler
[ALL] com.maclema.mysql::Connection                : Set Data Handler To: 
com.maclema.mysql::QueryHandler
[ALL] com.maclema.mysql::Connection                : Send Command (Command: 3 
Data: 
select revision from revision)
[ALL] com.maclema.mysql::Connection                : Socket Data (52 bytes)
[ALL] com.maclema.mysql::QueryHandler              : Push Packet (Total 
Packets: 0)
[ALL] com.maclema.mysql::QueryHandler              : New Packet
[ALL] com.maclema.mysql::QueryHandler              : Next Packet
[ALL] com.maclema.mysql::QueryHandler              : Query Response Packet
[ALL] com.maclema.mysql::Connection                : Unregistered Data Handler
[ALL] com.maclema.mysql::Statement                 : Dispatching 
Result/Response 
Responder
TypeError: Error #1009: Cannot access a property or method of a null object 
reference.
    at <anonymous>()[\src\com\project\classes\Server.as:151]
    at com.maclema.mysql::Statement/handleResponse()
[\src\com\maclema\mysql\Statement.as:35]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at com.maclema.mysql::QueryHandler/handleNextPacket()
[\src\com\maclema\mysql\QueryHandler.as:62]
    at com.maclema.mysql::QueryHandler/newPacket()
[\src\com\maclema\mysql\QueryHandler.as:35]
    at com.maclema.mysql::DataHandler/pushPacket()
[\src\com\maclema\mysql\DataHandler.as:34]
    at com.maclema.mysql::Connection/checkForPackets()
[\src\com\maclema\mysql\Connection.as:173]
    at com.maclema.mysql::Connection/onSocketData()
[\src\com\maclema\mysql\Connection.as:144]

This is the result I get now... Actually it thanks to your new Connection.as 
file, I 
was able to detect the for some reason the closeConnection function was called 
to 
early, and some queries were still pending. I replaced my disconnect with 1 
main 
disconnect when the program closes, which is certainly not an issue in this 
case.
The error I get now is on the line 

        st.executeQuery("select revision from revision", new MySqlResponser(
                function (e:MySqlEvent):void 
                {
                    var rs:ResultSet = e.resultSet;
Error-->            trace(rs.size());
                    if ( rs.next() ) {
                        trace('ok');
                    Alert.show("Returned: " + rs.getNumber
("revision"));
                }
                },
                function (e:MySqlErrorEvent):void
                {
                    Alert.show("Error: " + e.text);
                }
               ));

The update query works perfectly though. It's only the select query that is 
giving 
this issues. But so I guess this is no longer related to the unexpected 
connection 
close...

Original comment by davy.mo...@gmail.com on 16 May 2008 at 9:44

GoogleCodeExporter commented 9 years ago
hmm. Did you ever figure this out? What error are you getting on this line?

Original comment by macl...@gmail.com on 21 May 2008 at 4:10

GoogleCodeExporter commented 9 years ago
No didn't figure it out yet.
The error I get is the one from my previous post:
TypeError: Error #1009: Cannot access a property or method of a null object 
reference.

Original comment by davy.mo...@gmail.com on 21 May 2008 at 7:52

GoogleCodeExporter commented 9 years ago
hmm, thats really odd that you get an error on rs.size(). That only calls
rows.length, and rows is an array initialized in the constructor that should 
never be
null.

Would I be able to see more of the code? If you don't want to post publicly, 
you can
email me directly at maclema -at- gmail.com.

Original comment by macl...@gmail.com on 22 May 2008 at 10:57

GoogleCodeExporter commented 9 years ago
I have just commited another fix to subversion to Buffer.as, it may also be the 
cause
of this issue. If you could check-out the latest version and test again that 
would be
great.

Original comment by macl...@gmail.com on 22 May 2008 at 3:15

GoogleCodeExporter commented 9 years ago

Original comment by macl...@gmail.com on 26 May 2008 at 3:37

GoogleCodeExporter commented 9 years ago
Hello,

Sorry for the delayed response. I've just been testing with your newest release 
v2.4 
and all is working fine for me now... Thanks for your feedback!

Original comment by davy.mo...@gmail.com on 27 May 2008 at 11:00

GoogleCodeExporter commented 9 years ago

Original comment by macl...@gmail.com on 27 May 2008 at 4:16