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

This object is in zombie state #1

Open
damiendubreuil opened this issue Feb 17, 2016 · 4 comments
Open

This object is in zombie state #1

damiendubreuil opened this issue Feb 17, 2016 · 4 comments

Comments

@damiendubreuil
Copy link

Hello,

A program made in VB with Excel causes error 'This object is in zombie state' when there are requests in loops.

The following piece of program is an example of the problem. The error appears when 'drop table' are execute in do while loop.

Set r = ExecuteQuery("select table_name from user_tables where table_name in ('T_SSTAB_TEMP','T_ELT_TEMP', " _ & "'T_SSTABINST_SAV', 'T_SSTABINST_MOD', 'T_ELTINST_SAV', 'T_ELTINST_MOD')")
Do While Not r.EOF
ExecuteQuery ("drop table " & r.Fields(0))
r.MoveNext
Loop

On this topic, the problem seems to be the same.

Thanks for your answer.

@novascorbe
Copy link

Same problem with a C++/ATL program :

HRESULT CLoop::LoopDrop(OracleDataSource* dataSource)
{
HRESULT ret = S_OK;

CString Requete = "SELECT * FROM loop_toto";
HRESULT res = Open(dataSource->m_Session, Requete, dataSource->m_PropSet);
res = MoveFirst();
if (res != S_OK)
    ret = res;

for (auto i = 0; i < 4; i++)
{
    CDummy dum;

    Requete = "DROP TABLE " + CString(m_nom);

    res = dum.Open(dataSource->m_Session, Requete, (DBPROPSET*)NULL, (DBROWCOUNT*)NULL, DBGUID_DEFAULT, false);
    if (res != S_OK)
        ret = res;
    dum.Close();

    res = MoveNext();
    if (res != S_OK)
        ret = res;
}
Close();

return ret;

}

Error occurs in the first call of MoveNext with the error code E_UNEXPECTED

This error seems to be raised in Rowset::GetNextRows because m_nStatus==1

@novascorbe
Copy link

I wonder why DoCASCCICommit (TransactionLocal.cpp) is calling TxnCallback
These calls will call cci_close_req_handle for each request of the current connection.
It's why the MoveNext failed :

T_CCI_ERROR err_buf;
int rc = cci_end_tran(m_hConn, bCommit?CCI_TRAN_COMMIT:CCI_TRAN_ROLLBACK, &err_buf);
if(rc<0) return bCommit?XACT_E_COMMITFAILED:E_FAIL;

// TxnCallbackÀ» È£ÃâÇØ Á»ºñ·Î ¸¸µç´Ù.

POSITION pos = m_grpTxnCallbacks.GetHeadPosition();
while(pos)
    m_grpTxnCallbacks.GetNext(pos)->TxnCallback(0);

return S_OK;

@gwangil-choi
Copy link

@damiendubreuil @novascorbe
open database connection outside of loop
and close after loop

like this
Private Sub Command1_Click()

Dim Conn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rs As New ADODB.Recordset
Dim strConn As String

'ODBC driver connect
'strConn = strConn & "driver={CUBRID Driver};"
'strConn = strConn & "server=localhost;"
'strConn = strConn & "port=33000;"
'strConn = strConn & "uid=dba;"
'strConn = strConn & "pwd=;"
'strConn = strConn & "db_name=demodb;"

'OLE DB driver connect
strConn = strConn & "Provider = CUBRIDProvider;"
strConn = strConn & "Data Source = demodb;"
strConn = strConn & "Location = localhost;"
strConn = strConn & "User ID = dba;"
strConn = strConn & "Password =;"
strConn = strConn & "Port = 33000;"
strConn = strConn & "Fetch Size = 100;"
strConn = strConn & "Persist Security Info = True;"

Set Conn = New ADODB.Connection
With Conn
  .ConnectionString = strConn
  .Open
End With

With cmd
    .ActiveConnection = Conn
    .CommandText = "SELECT * FROM code;"
    .CommandType = adCmdText
End With

With rs
    .Open cmd
End With

List1.Clear
If Not rs.EOF Then rs.MoveFirst
Do While Not rs.EOF
    List1.AddItem rs.Fields(0) & ", " & rs.Fields(1)
    rs.MoveNext
Loop

Conn.Close

Set Conn = Nothing
Set cmd = Nothing
Set rs = Nothing

End Sub

@novascorbe
Copy link

Thank you for this nice workaround but the macro is not ours and we don't have the right to change it.
Finally I commented the lines :

POSITION pos = m_grpTxnCallbacks.GetHeadPosition();
while(pos)
    m_grpTxnCallbacks.GetNext(pos)->TxnCallback(0);

And now the driver works like a charm.

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

No branches or pull requests

3 participants