Index: src/libs/zbxnix/fatal.c
===================================================================
--- src/libs/zbxnix/fatal.c	(revision 78658)
+++ src/libs/zbxnix/fatal.c	(revision 79535)
@@ -39,6 +39,7 @@
 
 #include "common.h"
 #include "log.h"
+#include "zbxalgo.h"
 
 #include "fatal.h"
 
@@ -207,6 +208,131 @@
 
 #endif	/* defined(HAVE_SYS_UCONTEXT_H) && (defined(REG_EIP) || defined(REG_RIP)) */
 
+/* copied from dbconfig.h */
+typedef struct
+{
+	zbx_uint64_t		triggerid;
+	const char		*description;
+	const char		*expression;
+	const char		*recovery_expression;
+	const char		*error;
+	const char		*correlation_tag;
+	int			lastchange;
+	unsigned char		topoindex;
+	unsigned char		priority;
+	unsigned char		type;
+	unsigned char		value;
+	unsigned char		state;
+	unsigned char		locked;
+	unsigned char		status;
+	unsigned char		functional;		/* see TRIGGER_FUNCTIONAL_* defines */
+	unsigned char		recovery_mode;		/* TRIGGER_RECOVERY_MODE_* defines  */
+	unsigned char		correlation_mode;	/* ZBX_TRIGGER_CORRELATION_* defines */
+
+	zbx_vector_ptr_t	tags;
+}
+ZBX_DC_TRIGGER;
+
+typedef struct
+{
+	zbx_uint64_t		itemid;
+	zbx_uint64_t		hostid;
+	zbx_uint64_t		interfaceid;
+	zbx_uint64_t		lastlogsize;
+	zbx_uint64_t		valuemapid;
+	const char		*key;
+	const char		*port;
+	const char		*error;
+	const char		*delay;
+	ZBX_DC_TRIGGER		**triggers;
+	int			nextcheck;
+	int			lastclock;
+	int			mtime;
+	int			data_expected_from;
+	int			history_sec;
+	unsigned char		history;
+	unsigned char		type;
+	unsigned char		value_type;
+	unsigned char		poller_type;
+	unsigned char		state;
+	unsigned char		db_state;
+	unsigned char		inventory_link;
+	unsigned char		location;
+	unsigned char		flags;
+	unsigned char		status;
+	unsigned char		unreachable;
+	unsigned char		schedulable;
+	unsigned char		update_triggers;
+}
+ZBX_DC_ITEM;
+
+extern ZBX_DC_TRIGGER	fatal_dbg_trigger;	/* ZBX-13347 */
+extern ZBX_DC_ITEM	fatal_dbg_item;		/* ZBX-13347 */
+extern unsigned char	program_type;
+
+static void dump_trigger(ZBX_DC_TRIGGER *trigger)
+{
+	char buff[sizeof(ZBX_DC_TRIGGER) * 3 + 1];
+	int i;
+
+	for (i = 0; i < sizeof(ZBX_DC_TRIGGER); i++)
+		zbx_snprintf(&buff[i * 3], 4, "%02x ", 0xFF & ((unsigned char *)trigger)[i]);
+
+	zabbix_log(LOG_LEVEL_CRIT, "trigger dump(%dB): %s", sizeof(ZBX_DC_TRIGGER), buff);
+
+	zabbix_log(LOG_LEVEL_CRIT, "triggerid:" ZBX_FS_UI64 " description:'%p' type:%u status:%u priority:%u",
+				trigger->triggerid, trigger->description, trigger->type, trigger->status,
+				trigger->priority);
+	zabbix_log(LOG_LEVEL_CRIT, "  expression:'%p' cached:'%p'", trigger->expression,
+			trigger->recovery_expression);
+	zabbix_log(LOG_LEVEL_CRIT, "  value:%u state:%u error:'%p' lastchange:%d", trigger->value,
+			trigger->state, trigger->error, trigger->lastchange);
+	zabbix_log(LOG_LEVEL_CRIT, "  topoindex:%u functional:%u locked:%u", trigger->topoindex,
+			trigger->functional, trigger->locked);
+}
+
+static void dump_item(ZBX_DC_ITEM *item)
+{
+	char buff[sizeof(ZBX_DC_ITEM) * 3 + 1];
+	int i, j;
+
+	zabbix_log(LOG_LEVEL_CRIT, "--- Item dump: ---");
+
+	for (i = 0; i < sizeof(ZBX_DC_ITEM); i++)
+		zbx_snprintf(&buff[i * 3], 4, "%02x ", 0xFF & ((unsigned char *)item)[i]);
+
+	zabbix_log(LOG_LEVEL_CRIT, "item dump(%dB): %s", sizeof(ZBX_DC_ITEM), buff);
+
+	zabbix_log(LOG_LEVEL_CRIT, "itemid:" ZBX_FS_UI64 " hostid:" ZBX_FS_UI64 " key:'%s'",
+					item->itemid, item->hostid, item->key);
+	zabbix_log(LOG_LEVEL_CRIT, "  type:%u value_type:%u", item->type, item->value_type);
+	zabbix_log(LOG_LEVEL_CRIT, "  interfaceid:" ZBX_FS_UI64 " port:'%s'", item->interfaceid, item->port);
+	zabbix_log(LOG_LEVEL_CRIT, "  state:%u error:'%s'", item->state, item->error);
+	zabbix_log(LOG_LEVEL_CRIT, "  flags:%u status:%u", item->flags, item->status);
+	zabbix_log(LOG_LEVEL_CRIT, "  valuemapid:" ZBX_FS_UI64, item->valuemapid);
+	zabbix_log(LOG_LEVEL_CRIT, "  lastlogsize:" ZBX_FS_UI64 " mtime:%d", item->lastlogsize, item->mtime);
+	zabbix_log(LOG_LEVEL_CRIT, "  delay:'%s' nextcheck:%d lastclock:%d", item->delay, item->nextcheck,
+			item->lastclock);
+	zabbix_log(LOG_LEVEL_CRIT, "  data_expected_from:%d", item->data_expected_from);
+	zabbix_log(LOG_LEVEL_CRIT, "  triggers:%p history:%d", item->triggers, item->history);
+	zabbix_log(LOG_LEVEL_CRIT, "  poller_type:%u location:%u", item->poller_type, item->location);
+	zabbix_log(LOG_LEVEL_CRIT, "  inventory_link:%u", item->inventory_link);
+	zabbix_log(LOG_LEVEL_CRIT, "  unreachable:%u schedulable:%u", item->unreachable, item->schedulable);
+
+	if (NULL != item->triggers)
+	{
+		ZBX_DC_TRIGGER	*trigger;
+
+		zabbix_log(LOG_LEVEL_CRIT, "  triggers:");
+
+		for (j = 0; NULL != (trigger = item->triggers[j]); j++)
+		{
+			zabbix_log(LOG_LEVEL_CRIT, "--- Trigger dump: ---");
+			dump_trigger(trigger);
+		}
+	}
+}
+
 void	zbx_log_fatal_info(void *context, unsigned int flags)
 {
 #ifdef	HAVE_SYS_UCONTEXT_H
@@ -242,7 +368,7 @@
 
 #endif	/* HAVE_EXECINFO_H */
 
-	int	i;
+	int	i, is_tr_dump = 0;
 	FILE	*fd;
 
 	zabbix_log(LOG_LEVEL_CRIT, "====== Fatal information: ======");
@@ -314,7 +440,14 @@
 		else
 		{
 			for (i = 0; i < bcktrc_sz; i++)
+			{
 				zabbix_log(LOG_LEVEL_CRIT, "%d: %s", bcktrc_sz - i - 1, bcktrc_syms[i]);
+				if (0 != (program_type & ZBX_PROGRAM_TYPE_SERVER) &&
+					NULL != strstr(bcktrc_syms[i], "zbx_strdup"))
+				{
+					is_tr_dump = 1;
+				}
+			}
 
 			zbx_free(bcktrc_syms);
 		}
@@ -324,6 +457,14 @@
 #endif	/* HAVE_EXECINFO_H */
 	}
 
+	if (0 != is_tr_dump)
+	{
+		zabbix_log(LOG_LEVEL_CRIT, "=== ZBX-13347 dump: ===");
+		zabbix_log(LOG_LEVEL_CRIT, "--- Last trigger: ---");
+		dump_trigger(&fatal_dbg_trigger);
+		dump_item(&fatal_dbg_item);
+	}
+
 	if (0 != (flags & ZBX_FATAL_LOG_MEM_MAP))
 	{
 		zabbix_log(LOG_LEVEL_CRIT, "=== Memory map: ===");
Index: src/libs/zbxdbcache/dbconfig.c
===================================================================
--- src/libs/zbxdbcache/dbconfig.c	(revision 78658)
+++ src/libs/zbxdbcache/dbconfig.c	(revision 79535)
@@ -40,6 +40,9 @@
 #include "dbconfig.h"
 #include "dbsync.h"
 
+ZBX_DC_TRIGGER	fatal_dbg_trigger = {0}; /* ZBX-13347 */
+ZBX_DC_ITEM	fatal_dbg_item = {0}; /* ZBX-13347 */
+
 static int	sync_in_progress = 0;
 
 #define	LOCK_CACHE	if (0 == sync_in_progress) zbx_mutex_lock(&config_lock)
@@ -5953,6 +5956,7 @@
 static void	DCget_trigger(DC_TRIGGER *dst_trigger, ZBX_DC_TRIGGER *src_trigger)
 {
 	int	i;
+	fatal_dbg_trigger = *src_trigger; /* ZBX-13347 */
 
 	dst_trigger->triggerid = src_trigger->triggerid;
 	dst_trigger->description = zbx_strdup(NULL, src_trigger->description);
@@ -6608,10 +6612,13 @@
 		if (NULL == (dc_item = zbx_hashset_search(&config->items, &itemids[i])) || NULL == dc_item->triggers)
 			continue;
 
+		fatal_dbg_item = *dc_item;
+
 		/* process all triggers for the specified item */
 
 		for (j = 0; NULL != (dc_trigger = dc_item->triggers[j]); j++)
 		{
+
 			if (TRIGGER_STATUS_ENABLED != dc_trigger->status)
 				continue;
 
Index: src/zabbix_agent/zabbix_agentd.c
===================================================================
--- src/zabbix_agent/zabbix_agentd.c	(revision 78658)
+++ src/zabbix_agent/zabbix_agentd.c	(revision 79535)
@@ -229,6 +229,10 @@
 void	zbx_co_uninitialize();
 #endif
 
+int fatal_dbg_trigger; /* ZBX-13347 */
+int fatal_dbg_item; /* ZBX-13347 */
+
+
 int	get_process_info_by_thread(int local_server_num, unsigned char *local_process_type, int *local_process_num);
 
 int	get_process_info_by_thread(int local_server_num, unsigned char *local_process_type, int *local_process_num)
Index: .
===================================================================
--- .	(revision 78658)
+++ .	(revision 79535)

Property changes on: .
___________________________________________________________________
Modified: svn:mergeinfo
## -0,0 +0,1 ##
   Merged /branches/dev/ZBX-13347-30:r78644
