|
|
c17bfd |
From c49e42f4f8381fc8e92579c41cefb2c85fe45929 Mon Sep 17 00:00:00 2001
|
|
|
c17bfd |
From: Rainer Gerhards <rgerhards@adiscon.com>
|
|
|
c17bfd |
Date: Tue, 7 Feb 2017 13:09:40 +0100
|
|
|
c17bfd |
Subject: [PATCH] core: fix sequence error in msg object deserializer
|
|
|
c17bfd |
|
|
|
c17bfd |
Corruption of disk queue (or disk part of DA queue) always happens if
|
|
|
c17bfd |
the "json" property (message variables) is present and "structured-data"
|
|
|
c17bfd |
property is also present. This causes rsyslog to serialize to the
|
|
|
c17bfd |
queue in wrong property sequence, which will lead to error -2308 on
|
|
|
c17bfd |
deserialization.
|
|
|
c17bfd |
|
|
|
c17bfd |
Seems to be a long-standing bug. Depending on version used, some or
|
|
|
c17bfd |
all messages in disk queue may be lost.
|
|
|
c17bfd |
|
|
|
c17bfd |
closes https://github.com/rsyslog/rsyslog/issues/1404
|
|
|
c17bfd |
---
|
|
|
c17bfd |
runtime/msg.c | 14 ++++++++------
|
|
|
c17bfd |
1 file changed, 8 insertions(+), 6 deletions(-)
|
|
|
c17bfd |
|
|
|
c17bfd |
diff --git a/runtime/msg.c b/runtime/msg.c
|
|
|
c17bfd |
index 7cfeca843..cfa95517e 100644
|
|
|
c17bfd |
--- a/runtime/msg.c
|
|
|
c17bfd |
+++ b/runtime/msg.c
|
|
|
c17bfd |
@@ -1350,6 +1350,11 @@ MsgDeserialize(smsg_t * const pMsg, strm_t *pStrm)
|
|
|
c17bfd |
reinitVar(pVar);
|
|
|
c17bfd |
CHKiRet(objDeserializeProperty(pVar, pStrm));
|
|
|
c17bfd |
}
|
|
|
c17bfd |
+ if(isProp("pszStrucData")) {
|
|
|
c17bfd |
+ MsgSetStructuredData(pMsg, (char*) rsCStrGetSzStrNoNULL(pVar->val.pStr));
|
|
|
c17bfd |
+ reinitVar(pVar);
|
|
|
c17bfd |
+ CHKiRet(objDeserializeProperty(pVar, pStrm));
|
|
|
c17bfd |
+ }
|
|
|
c17bfd |
if(isProp("json")) {
|
|
|
c17bfd |
tokener = json_tokener_new();
|
|
|
c17bfd |
pMsg->json = json_tokener_parse_ex(tokener, (char*)rsCStrGetSzStrNoNULL(pVar->val.pStr),
|
|
|
c17bfd |
@@ -1366,11 +1371,6 @@ MsgDeserialize(smsg_t * const pMsg, strm_t *pStrm)
|
|
|
c17bfd |
reinitVar(pVar);
|
|
|
c17bfd |
CHKiRet(objDeserializeProperty(pVar, pStrm));
|
|
|
c17bfd |
}
|
|
|
c17bfd |
- if(isProp("pszStrucData")) {
|
|
|
c17bfd |
- MsgSetStructuredData(pMsg, (char*) rsCStrGetSzStrNoNULL(pVar->val.pStr));
|
|
|
c17bfd |
- reinitVar(pVar);
|
|
|
c17bfd |
- CHKiRet(objDeserializeProperty(pVar, pStrm));
|
|
|
c17bfd |
- }
|
|
|
c17bfd |
if(isProp("pCSAPPNAME")) {
|
|
|
c17bfd |
MsgSetAPPNAME(pMsg, (char*) rsCStrGetSzStrNoNULL(pVar->val.pStr));
|
|
|
c17bfd |
reinitVar(pVar);
|
|
|
c17bfd |
@@ -1401,8 +1401,10 @@ MsgDeserialize(smsg_t * const pMsg, strm_t *pStrm)
|
|
|
c17bfd |
* but on the other hand it works decently AND we will probably replace
|
|
|
c17bfd |
* the whole persisted format soon in any case. -- rgerhards, 2012-11-06
|
|
|
c17bfd |
*/
|
|
|
c17bfd |
- if(!isProp("offMSG"))
|
|
|
c17bfd |
+ if(!isProp("offMSG")) {
|
|
|
c17bfd |
+ DBGPRINTF("error property: %s\n", rsCStrGetSzStrNoNULL(pVar->pcsName));
|
|
|
c17bfd |
ABORT_FINALIZE(RS_RET_DS_PROP_SEQ_ERR);
|
|
|
c17bfd |
+ }
|
|
|
c17bfd |
MsgSetMSGoffs(pMsg, pVar->val.num);
|
|
|
c17bfd |
finalize_it:
|
|
|
c17bfd |
if(pVar != NULL)
|