Hi Johannes, On Thu, Feb 28, 2013 at 10:44:15PM +0100, Johannes Hofmann wrote:
Hi,
from time to time I get the crash below. Would a simple NULL check in a_Chain_check() be the correct fix?
I gave it a first review, and it looks like the connection gets closed before the dialog sends an answer. So, at resume time, the sending branch is gone. It'd be great to have a test case. Anyway, in the interim, please try the following patch: diff -r 8c8975054b06 src/capi.c --- a/src/capi.c Wed Jan 30 10:04:00 2013 +0100 +++ b/src/capi.c Fri Mar 01 13:32:38 2013 -0300 @@ -571,10 +571,13 @@ int a_Capi_dpi_send_data(const DilloUrl /* Re-use an open connection */ conn = Capi_conn_find(server); if (conn) { - /* found */ - dbuf = a_Chain_dbuf_new(data, data_sz, 0); - a_Capi_ccc(OpSend, 1, BCK, conn->InfoSend, dbuf, NULL); - dFree(dbuf); + if (conn->InfoSend) { + /* found & operative*/ + dbuf = a_Chain_dbuf_new(data, data_sz, 0); + a_Capi_ccc(OpSend, 1, BCK, conn->InfoSend, dbuf, NULL); + dFree(dbuf); + } else + MSG(" ERROR: [a_Capi_dpi_send_data] Connection not operative\n"); } else { MSG(" ERROR: [a_Capi_dpi_send_data] No open connection found\n"); } diff -r 8c8975054b06 src/chain.c --- a/src/chain.c Wed Jan 30 10:04:00 2013 +0100 +++ b/src/chain.c Fri Mar 01 13:32:38 2013 -0300 @@ -189,7 +189,10 @@ int a_Chain_check(char *FuncStr, int Op, /* Show status information */ Chain_debug_msg(FuncStr, Op, Branch, Dir, Info); - if (Info->Flags & (CCC_Ended + CCC_Aborted)) { + if (!Info) { + MSG_WARN("CCC: call on a NULL node.\n" + "Caught as last resort; Most probably a BUG.\n"); + } else if (Info->Flags & (CCC_Ended + CCC_Aborted)) { /* CCC is not operative */ MSG_WARN("CCC: call on already finished chain. Flags=%s%s\n", Info->Flags & CCC_Ended ? "CCC_Ended " : "", -- Cheers Jorge.-