65 Commits

Author SHA1 Message Date
Rainer Gerhards
1d7e772088 core: replace some inline functions by macros
I consider the C99 semantics to be pretty broken. Rather than
duplicating code for the inline variant and the non-inline one,
I replace the functions in question by macros. We do not loose
much in terms of type-safety.

see also https://github.com/rsyslog/rsyslog/pull/2246
2017-12-18 12:40:34 +01:00
Rainer Gerhards
ce06bba15c RainerScript: implement previous_action_suspended() function
This function returns a boolean indicating if the previous action is
suspended (0 - no, 1 - yes). This is useful if arbitrary processing
(other than calling actions) should be made depending on that state.
A prime example for this is probably calling a ruleset.

closes https://github.com/rsyslog/rsyslog/issues/1939
2017-12-09 17:48:28 +01:00
Rainer Gerhards
b63d3051bc RainerScript: add function script_error() and error-reporting support
This permits script functions that could fail to report errors back, so
that the user can handle them if desired. We use an errno-style of
interface. That means script_error() needs to be called after functions
that supports it. It will return either 0 (all OK) or something else
(an error condition).

The commit also modifies the parse_time() function to use the new
interface. First of all, this is useful for users, and secondly we
needed a capability to craft a testbench test.

closes https://github.com/rsyslog/rsyslog/issues/1978
2017-12-09 16:08:36 +01:00
Rainer Gerhards
3701e7ec91 core/wrkr threads: fix race condition
During e.g. shutdown it could happen that a worker thread was started
and immediately be requested to terminate. In such situations there was
a race the prevented proper initialization. This could lead to follow-on
problems.

We believe (but could not proof) that this also could lead to a hang of
the termination process. Thus we claim to close an issue tracker down
here below, but are not 100% certain it really closes it (we hope for
user feedback on this). In any case, the thread debuger showed invalid
operations and this has been fixed, so it is useful in any case.

closes https://github.com/rsyslog/rsyslog/issues/1959
2017-11-10 19:03:09 +01:00
Rainer Gerhards
71b0922c22 action handler: detected and handle DATAFAIL error during action processing 2017-10-12 13:26:10 +02:00
Rainer Gerhards
149c23368b action bugfix: no "action suspended" message during retry processing
The action engine does not emit "action suspended" messages but "resumed"
ones in retry processing. This is wrong, as they are a strong indication
that something does not work correctly. Nevertheless, "resumed" messages
were emitted, which was very puzzling for the user.

This patch fixes it so that "suspend" messages are given during retry
processing. These do not contain a retry timestamp, providing evidence
that a retry is currently being tried.

closes https://github.com/rsyslog/rsyslog/issues/1069
2017-10-12 13:26:10 +02:00
Pascal Withopf
b63a6b9010 codestyle: line length adjusted 2017-01-17 08:54:37 +01:00
Rainer Gerhards
51c03c66e0 make inline functions C99-compliant
As it seems, different C compilers have different rules/interpretations
on inline functions. The current code base did not properly obey all C99
rules. We fix this by converting some functions to macros and others to
include the necessary C99 plumbing. We also remove some inline attributes
for functions where this seems to be to agressive (aka "function to big").

This fixes build problems in some environments and is a general code
cleanup measure.
2016-09-05 16:47:14 +02:00
Rainer Gerhards
7c52a118c9 fix missing includes causing build issues
I wonder why this did not come up earlier...
2016-08-22 18:17:40 +02:00
Rainer Gerhards
fe4fb59647 wti object: fix cosmetic memory leak
This "leak" happes only immediately before shutdown, so it is not
a real leak. But it can get in our way when working with memory
debuggers.
2016-04-23 18:09:36 +02:00
Rainer Gerhards
bbd0f01438 remove a couple of gcc --pedantic messages 2014-08-19 16:55:33 +02:00
Rainer Gerhards
8b326647d2 cleanup 2014-05-28 11:54:23 +02:00
Rainer Gerhards
30c8c4bdb1 Merge branch 'v7-stable' into master-merge
This was a rather complicated merge as we needed to migrate some
per-action settings (v7) to action instance settings (v8).

Conflicts:
	action.c
	action.h
	doc/global.html
	runtime/glbl.c
2014-03-03 15:49:01 +01:00
Rainer Gerhards
aa43e15a57 fix merge problems (interfaces have changed) 2013-12-19 17:12:47 +01:00
Rainer Gerhards
21d265bd84 regression fix: another address miscalculation fixed 2013-12-05 07:58:56 +01:00
Rainer Gerhards
a0d682ec1d fix memory adressing error in refactored code 2013-12-04 17:17:45 +01:00
Rainer Gerhards
4695ab7c3e refactor output system string handling 2013-12-04 16:49:22 +01:00
Rainer Gerhards
89df439930 more or less cosmetic 2013-12-04 13:02:50 +01:00
Rainer Gerhards
fb6dd02afc refactor milestone: create first PoC of commitTransaction() entry point 2013-12-04 11:38:07 +01:00
Rainer Gerhards
41a3489b70 refactor milestone: prep iparam structure for omod interface usage 2013-12-04 10:29:13 +01:00
Rainer Gerhards
be36ef5009 refactor doAction omod interface
we do no longer support the iMsgOpts parameter
2013-12-04 09:24:11 +01:00
Rainer Gerhards
140b5b22c0 cleanup/beautify 2013-12-03 18:57:05 +01:00
Rainer Gerhards
3b523a196a reduced number of malloc/frees during string template processing
We now re-use once allocated string template memory for as long
as the worker thread exists. This saves us from doing new memory
allocs (and their free counterpart) when the next message is
processed. The drawback is that the cache always is the size of
the so-far largest message processed. This is not considered a
problem, as in any case a single messages' memory footprint should
be far lower than that of a whole set of messages (especially on
busy servers).
2013-12-03 17:03:22 +01:00
Rainer Gerhards
a16113442e cleanup 2013-12-03 15:06:49 +01:00
Rainer Gerhards
6bd98320a4 another round of const qualifiers 2013-12-03 14:24:30 +01:00
Rainer Gerhards
dc84772973 refactor: shrink template string structures 2013-12-03 14:10:51 +01:00
Rainer Gerhards
9cc097832b failed action detection more precisely for a number of actions
If an action  uses string parameter passing but is non-transactional
it can be executed immediately, giving a quicker indicatio of
action failure.
2013-12-03 10:20:45 +01:00
Rainer Gerhards
23278699e3 Merge branch 'master-ruleeng' into master-ruleeng-simd 2013-11-07 12:57:49 +01:00
Rainer Gerhards
fb81cf202c Merge branch 'master' into master-ruleeng
Conflicts:
	runtime/wti.c
	runtime/wti.h
2013-11-07 12:57:36 +01:00
Pavel Levshin
772cba6f2e improve worker thread pool handling
among others, make possible that workers really timeout and the pool
thus shrinks
2013-11-06 18:37:47 +01:00
Rainer Gerhards
e3dc604142 refactor iparams to use array
this is also prep work for a single doTransaction() output mode api
2013-11-06 18:07:26 +01:00
Rainer Gerhards
2a94703425 refactor action disabling 2013-11-06 12:24:49 +01:00
Rainer Gerhards
176dea7654 make batches of 1 commit automatically after each action
This improves failover handling and makes it consistent with doc
(precise handling for batches of one).
2013-11-06 11:28:44 +01:00
Rainer Gerhards
08c262011d re-enable bPrevWasSuspended handling 2013-11-06 11:06:48 +01:00
Rainer Gerhards
e51de9f416 re-enable main queue direct mode 2013-11-05 17:47:35 +01:00
Rainer Gerhards
1142083565 refactor: move pbShutdownImmediate to wti_t 2013-11-05 08:59:42 +01:00
Rainer Gerhards
ce57131e1e experimentally split ruleset execution in exec and commit phase 2013-11-04 14:32:49 +01:00
Rainer Gerhards
08e96b620e refactor output side of action queue - main shot
this needs refinement, but basically we now do no longer rely on
batches for the sub-functions.
2013-11-02 12:04:33 +01:00
Rainer Gerhards
fbfc398463 refactor: move action resume retry counter to wti_t 2013-11-01 18:17:30 +01:00
Rainer Gerhards
7c74c432a7 some debug aids & useful commments for going forward 2013-11-01 18:06:58 +01:00
Rainer Gerhards
8c46d71293 refactor: move handling too-frequent tryResume == OK to wti_t 2013-11-01 17:34:38 +01:00
Rainer Gerhards
bf11ace45a refactor: move action state to wti (as we are now on a per-thread basis) 2013-11-01 17:22:32 +01:00
Rainer Gerhards
4ac27e73af call freeWrkrInstance() on worker thread termination 2013-10-29 18:16:57 +01:00
Rainer Gerhards
efa8dfb47d maintain action ids (actionNbr) 2013-10-26 13:54:45 +02:00
Rainer Gerhards
18e60f46a1 Merge branch 'v4-stable' into v5-stable
Conflicts:
	runtime/debug.h
	runtime/obj.c
	runtime/parser.h
	runtime/wti.h
2012-01-16 16:14:30 +01:00
Rainer Gerhards
bd22bf8cb4 license changes 2012-01-16 15:23:01 +01:00
Rainer Gerhards
7574e70df4 fixed race conditions during queue shutdown (DA case, disks active) 2010-05-18 17:53:12 +02:00
Rainer Gerhards
dd76d96d67 adapted new atomic instruction emulation to v5 engine
code did not compile after merge from v4
2010-04-27 18:26:09 +02:00
Rainer Gerhards
4a5a3196fb Merge branch 'v4-devel' into master
Conflicts:
	runtime/Makefile.am
	runtime/atomic.h
	runtime/queue.c
	runtime/queue.h
	runtime/wti.c
	runtime/wti.h
	runtime/wtp.c
	runtime/wtp.h
2010-04-27 17:49:06 +02:00
Rainer Gerhards
cbe2e3d444 bugfix: problems with atomic operations emulation
replaced atomic operation emulation with new code. The previous code
seemed to have some issue and also limited concurrency severely. The
whole atomic operation emulation has been rewritten.
2010-04-27 17:31:28 +02:00