From b4d4366986b464ae4a75594ab7df0a5edb2ee08f Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 11 Aug 2011 15:05:00 +0200 Subject: bugfixes for tag emulation - bugfix: potential hang condition during tag emulation - bugfix: too-early string termination during tag emulation --- runtime/msg.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'runtime') diff --git a/runtime/msg.c b/runtime/msg.c index 9fdaded3..b18fb530 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -1697,8 +1697,11 @@ static inline void tryEmulateTAG(msg_t *pM, sbool bLockMutex) if(bLockMutex == LOCK_MUTEX) MsgLock(pM); - if(pM->iLenTAG > 0) + if(pM->iLenTAG > 0) { + if(bLockMutex == LOCK_MUTEX) + MsgUnlock(pM); return; /* done, no need to emulate */ + } if(getProtocolVersion(pM) == 1) { if(!strcmp(getPROCID(pM, MUTEX_ALREADY_LOCKED), "-")) { @@ -1708,7 +1711,7 @@ static inline void tryEmulateTAG(msg_t *pM, sbool bLockMutex) /* now we can try to emulate */ lenTAG = snprintf((char*)bufTAG, CONF_TAG_MAXSIZE, "%s[%s]", getAPPNAME(pM, MUTEX_ALREADY_LOCKED), getPROCID(pM, MUTEX_ALREADY_LOCKED)); - bufTAG[32] = '\0'; /* just to make sure... */ + bufTAG[sizeof(bufTAG)-1] = '\0'; /* just to make sure... */ MsgSetTAG(pM, bufTAG, lenTAG); } } -- cgit From 169791752520693d3c81568037bfa319e5081819 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Fri, 12 Aug 2011 14:48:43 +0200 Subject: Added debug output into message parsers needed for bugtracking Changed version to 5.8.5-pre1 --- runtime/msg.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'runtime') diff --git a/runtime/msg.c b/runtime/msg.c index b18fb530..f1de8130 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -1661,6 +1661,8 @@ void MsgSetTAG(msg_t *pMsg, uchar* pszBuf, size_t lenBuf) uchar *pBuf; assert(pMsg != NULL); +dbgprintf("MsgSetTAG in: len %d, pszBuf: %s\n", lenBuf, pszBuf); + freeTAG(pMsg); pMsg->iLenTAG = lenBuf; @@ -1679,6 +1681,8 @@ void MsgSetTAG(msg_t *pMsg, uchar* pszBuf, size_t lenBuf) memcpy(pBuf, pszBuf, pMsg->iLenTAG); pBuf[pMsg->iLenTAG] = '\0'; /* this also works with truncation! */ + +dbgprintf("MsgSetTAG exit: pMsg->iLenTAG %d, pMsg->TAG.szBuf: %s\n", pMsg->iLenTAG, pMsg->TAG.szBuf); } @@ -1737,6 +1741,7 @@ getTAG(msg_t *pM, uchar **ppBuf, int *piLen) *piLen = pM->iLenTAG; } } +dbgprintf("getTAG: len %d, buf '%s'\n", *piLen, *ppBuf); } -- cgit From 47ed9921b6c9fe49d4aadf244f7df1ce4d05a5b3 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Thu, 18 Aug 2011 09:36:59 +0200 Subject: bugfix: fixed incorrect state handling for Discard Action (transactions) --- runtime/queue.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'runtime') diff --git a/runtime/queue.c b/runtime/queue.c index 00eb76c7..554c6a43 100644 --- a/runtime/queue.c +++ b/runtime/queue.c @@ -88,6 +88,15 @@ static rsRetVal qqueueMultiEnqObjDirect(qqueue_t *pThis, multi_submit_t *pMultiS #define QUEUE_CHECKPOINT 1 #define QUEUE_NO_CHECKPOINT 0 +/* debug aid */ +static void displayBatchState(batch_t *pBatch) +{ + int i; + for(i = 0 ; i < pBatch->nElem ; ++i) { + dbgprintf("XXXXX: displayBatchState %p[%d]: %d\n", pBatch, i, pBatch->pElem[i].state); + } +} + /*********************************************************************** * we need a private data structure, the "to-delete" list. As C does * not provide any partly private data structures, we implement this @@ -882,6 +891,8 @@ rsRetVal qqueueEnqObjDirectBatch(qqueue_t *pThis, batch_t *pBatch) ASSERT(pThis != NULL); +dbgprintf("XXXXX: pre call consumer\n"); +displayBatchState(pBatch); /* calling the consumer is quite different here than it is from a worker thread */ /* we need to provide the consumer's return value back to the caller because in direct * mode the consumer probably has a lot to convey (which get's lost in the other modes @@ -892,6 +903,8 @@ rsRetVal qqueueEnqObjDirectBatch(qqueue_t *pThis, batch_t *pBatch) */ iRet = pThis->pConsumer(pThis->pUsr, pBatch, &pThis->bShutdownImmediate); +dbgprintf("XXXXX: post call consumer\n"); +displayBatchState(pBatch); RETiRet; } -- cgit From 154747929f87010b444af2d552f980daafe451e6 Mon Sep 17 00:00:00 2001 From: Andre Lorbach Date: Thu, 18 Aug 2011 13:15:10 +0200 Subject: removed debug code from action.c and runtime/queue.c after testing --- runtime/queue.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'runtime') diff --git a/runtime/queue.c b/runtime/queue.c index 554c6a43..9012abeb 100644 --- a/runtime/queue.c +++ b/runtime/queue.c @@ -891,8 +891,6 @@ rsRetVal qqueueEnqObjDirectBatch(qqueue_t *pThis, batch_t *pBatch) ASSERT(pThis != NULL); -dbgprintf("XXXXX: pre call consumer\n"); -displayBatchState(pBatch); /* calling the consumer is quite different here than it is from a worker thread */ /* we need to provide the consumer's return value back to the caller because in direct * mode the consumer probably has a lot to convey (which get's lost in the other modes @@ -903,8 +901,6 @@ displayBatchState(pBatch); */ iRet = pThis->pConsumer(pThis->pUsr, pBatch, &pThis->bShutdownImmediate); -dbgprintf("XXXXX: post call consumer\n"); -displayBatchState(pBatch); RETiRet; } -- cgit