240 Commits

Author SHA1 Message Date
Rainer Gerhards
678a904620 bugfix: memory and file descriptor leak in stream processing
Leaks could occur under some circumstances if the file stream handler
errored out during the open call. Among others, this could cause very
big memory leaks if there were a problem with unreadable disk queue
files. In regard to the memory leak, this
closes: http://bugzilla.adiscon.com/show_bug.cgi?id=256
2011-05-03 09:41:35 +02:00
Rainer Gerhards
df6bad70d4 cosmetic: making comments in stream.c a bit more readable 2011-02-10 17:46:04 +01:00
Rainer Gerhards
b231db5253 Merge branch 'v5-stable' into v5-devel
Conflicts:
	ChangeLog
	configure.ac
	doc/manual.html
2011-01-26 13:03:19 +01:00
Rainer Gerhards
464103820b Merge branch 'v4-stable' into v5-stable 2011-01-26 12:38:02 +01:00
David Lang
9813a12789 enhanced imfile to support multi-line messages
Signed-off-by: Rainer Gerhards <rgerhards@adiscon.com>
2011-01-25 14:24:50 +01:00
Dražen Kačar
7742b2182f improved imudp real-time scheduling support & bugfix
The original code had quite some issues, which are fixed by this
commit. Also we do more error checking now.

Signed-off-by: Rainer Gerhards <rgerhards@adiscon.com>
2011-01-10 12:39:23 +01:00
Rainer Gerhards
cdc27aea8f imfile bugfix: potential duplication of log content
Under some circumstances an invalid truncation was detected. This
code has now been removed, a file change (and thus resent) is only
detected if the inode number changes.
2011-01-10 08:22:50 +01:00
Rainer Gerhards
25ff60f523 forgot the actual patch with the last commit :( 2010-12-17 18:34:39 +01:00
Rainer Gerhards
5085587806 bugfix: imfile potentially duplicates lines
This can happen when 0 bytes are read from the input file, and some
writer appends data to the file BEFORE we check if a rollover happens.
The check for rollover uses the inode and size as a criterion. So far,
we checked for equality of sizes, which is not given in this scenario,
but that does not indicate a rollover. From the source code comments:
   Note that when we check the size, we MUST NOT check for equality.
   The reason is that the file may have been written right after we
   did try to read (so the file size has increased). That is NOT in
   indicator of a rollover (this is an actual bug scenario we
   experienced). So we need to check if the new size is smaller than
   what we already have seen!
2010-12-17 18:18:57 +01:00
Rainer Gerhards
ed36822e37 Merge branch 'v4-stable' into v5-stable
Conflicts:

	configure.ac
	runtime/cfsysline.c
	tools/ompipe.c
2010-10-19 12:54:38 +02:00
Rainer Gerhards
0a24b3afc0 fixing some compile problems on FreeBSD 2010-10-19 12:39:48 +02:00
Rainer Gerhards
5d8b1846ec Merge branch 'v4-devel' into v5-beta
Conflicts:
	Makefile.am
	tests/tcpflood.c
2010-10-15 08:06:40 -07:00
Rainer Gerhards
3700a64d97 Merge branch 'v4-stable' into v4-devel
Conflicts:
	ChangeLog
	runtime/stream.c
2010-10-15 07:59:31 -07:00
Rainer Gerhards
90933057bc imfile: bugfixes in regard to large files (> 2GB)
- bugfix: a couple of problems that imfile had on some platforms, namely
  Ubuntu (not their fault, but occured there)
- bugfix: imfile utilizes 32 bit to track offset. Most importantly,
  this problem can not experienced on Fedora 64 bit OS (which has
  64 bit long's!)
2010-10-15 16:39:10 +02:00
Rainer Gerhards
f48128f34a fixed a couple of regressions
by implementing some code that was missing so far ;) as well as
finding some real bugs. I also did some general cleanup, removing
debug strings and such. This code should be fairly OK to use, except
when "exec only when previous action was suspended" is used -- this is
NOT yet re-implemented in the tuned engine.
2010-06-23 12:48:27 +02:00
Rainer Gerhards
527edddb46 Merge branch 'v4-devel'
Conflicts:
	runtime/msg.h
	runtime/rsyslog.h
	runtime/stream.c
2010-04-19 18:47:06 +02:00
Rainer Gerhards
84084ea2a1 improved quality of imsolaris code
including refctoring for a more simple solution
2010-04-19 18:39:55 +02:00
Rainer Gerhards
4e511087c4 some cleanup 2010-04-19 15:21:25 +02:00
Rainer Gerhards
8f0a8076cc Merge branch 'beta' into master
Conflicts:
	ChangeLog
	configure.ac
	plugins/imudp/imudp.c
	runtime/stream.h
	tests/Makefile.am
	tests/diag.sh
	tools/omfile.c
2010-04-09 13:00:56 +02:00
Rainer Gerhards
8b9cef552d Merge branch 'v4-stable' into v5-stable
Conflicts:
	ChangeLog
	configure.ac
	doc/manual.html
	runtime/debug.c
	runtime/stream.c
	tests/Makefile.am
	tests/diskqueue.sh
	tests/nettester.c
	tools/omfile.c
2010-03-29 11:07:15 +02:00
Rainer Gerhards
5d58774813 streamline dynafile cache entry deletion a bit
The old code looks a bit "strange", though not necessarily incorrect.
The new code looks correct and is probably less irritating during bug
hunting.
2010-03-23 14:21:33 +01:00
Rainer Gerhards
89216d6a96 fixed regression from previos (yet unrelease) $omfileFlushOnTXEnd fix
The previous fix fixed an issue with on/off bying used in the exact wrong
semantic. It corrected the situation, but failed to fix one spot where the
wrong semantics were used. This is done with this commit.

Note that this is NOT a bug seen in any released version.
2010-03-19 09:42:46 +01:00
Rainer Gerhards
9cdcba0bdc bugfix: invalid buffer write in (file) stream class
currently being accessed buffer could be overwritten with new data.
While this probably did not cause access violations, it could case loss
and/or duplication of some data (definitely a race with no deterministic
outcome)
2010-03-19 07:41:04 +01:00
Rainer Gerhards
3e0578605f bugfix: potential hang condition during filestream close
predicate was not properly checked when waiting for the background file
writer
2010-03-19 07:37:56 +01:00
Rainer Gerhards
e910078e41 bugfix: improper synchronization when "$OMFileFlushOnTXEnd on" was used
Internal data structures were not properly protected due to missing
mutex calls.
2010-03-19 07:19:28 +01:00
Rainer Gerhards
1fb45d3e99 some cleanup, some additional comments and a bit more debug output 2010-03-18 12:34:26 +01:00
Rainer Gerhards
d7faed130c bugfix(cosmetic): tried to close non-open fd, resulting in close(-1) 2010-03-16 19:06:01 +01:00
Rainer Gerhards
a577b09e58 reduced runtime requirements of inactive debug code a slight bit 2010-03-16 19:01:22 +01:00
Rainer Gerhards
ee8bf6d687 Merge branch 'v4-stable' into v4-stable-next 2010-03-10 09:58:46 +01:00
Rainer Gerhards
6c43f93022 fixed regression introduced with previous commit
disk queue mode did no longer work correctly. A side-effect of
this commit here is slightly cleaned-up (and more elegant) code
for circular files.
2010-03-10 09:52:49 +01:00
Rainer Gerhards
8833612e75 some cosmetic changes
note that a buffer size calculation was done wrong, but this was cosmetic
because our buffers currently all use byte size, so even though the
formula was wrong, the result was correct.
2010-03-10 08:21:41 +01:00
Rainer Gerhards
5996414f04 bugfixes and testbench improvement
- improved testbench
- bugfix: potential data loss during file stream shutdown
- bugfix: potential problems during file stream shutdown
  The shutdown/close sequence was not clean, what potentially (but
  unlikely) could lead to some issues. We have not been able to describe
  any fatal cases, but there was some bug potential. Sequence has now
  been straighted out.
2010-03-10 07:36:38 +01:00
Rainer Gerhards
3d80d6ba30 bugfix: potential problem (loop, abort) when file write error occured
When a write error occured in stream.c, variable iWritten had the error
code but this was handled as if it were the actual number of bytes
written. That was used in pointer arithmetic later on, and thus could
lead to all sorts of problems. However, this could only happen if the
error was EINTR or the file in question was a tty. All other cases were
handled properly. Now, iWritten is reset to zero in such cases, resulting
in proper retries.
2010-03-09 18:07:31 +01:00
Rainer Gerhards
38cb392672 replaced data type "bool" by "sbool" because this created some portability issues 2010-02-02 15:51:01 +01:00
Rainer Gerhards
9901996b5b Merge branch 'v4-beta' into beta
Conflicts:
	ChangeLog
2010-01-15 17:03:51 +01:00
Rainer Gerhards
5b4e06fc28 bugfix: rsyslog hangs when writing to a named pipe which nobody was reading.
Thanks to Michael Biebl for reporting this bug.
2010-01-15 17:01:10 +01:00
Rainer Gerhards
4578dc6a2d Merge branch 'v4-devel' into tmp 2009-11-05 14:34:21 +01:00
Rainer Gerhards
a5cd509be7 bugfix: named pipes did no longer work (they always got an open error)
this was a regression from the omfile rewrite in 4.5.0
2009-11-05 12:44:57 +01:00
Rainer Gerhards
e04e1b5002 enhanced test environment (including testbench)
support for enhancing probability of memory addressing failure by
using non-NULL default value for malloced memory (optional, only if
requested by configure option). This helps to track down some
otherwise undetected issues within the testbench and is expected
to be very useful in the future.
2009-10-22 11:33:38 +02:00
Rainer Gerhards
8d8d1f01e1 Merge branch 'v4-beta' into beta
Conflicts:
	ChangeLog
	configure.ac
	doc/manual.html
2009-09-29 10:09:51 +02:00
Rainer Gerhards
8bab264ba1 minor cleanup & preparation for 4.5.4 2009-09-29 09:50:39 +02:00
Rainer Gerhards
d15eb7fa83 bugfix: this morning's race patch was incomplete, completing now
we needed to release ALL resources (including file handles!) only
after the the async writer thread has terminated (else it may access
them). In this case, we had a file handle leak, because the handle was
sometimes only opened in the async writer, but the close was attempted
before the writer even started (in some cases).
2009-09-24 16:05:40 +02:00
Rainer Gerhards
eb9da005ba (temporary?) removal of very conservative locks in stream.c
...after we seem to have identified the root cause of the segfault.
I leave them commented out so that we can re-activate it if need
arises (aka "get some practice drill first").
2009-09-24 11:02:00 +02:00
Rainer Gerhards
e0dde79a80 bugfix: potential segfault in stream writer on destruction
Most severely affected omfile. The problem was that some buffers were
freed before the asynchronous writer thread was shut down. So the
writer thread accessed invalid data, which may even already be
overwritten. Symptoms (with omfile) were segfaults, grabled data
and files with random names placed around the file system (most
prominently into the root directory). Special thanks to Aaron for
helping to track this down.
2009-09-24 10:49:11 +02:00
Rainer Gerhards
44844b8af3 minor: increased buffer size to be safe in all cases
if the buffer was too small, we would see more API calls, but no
failure, so this is no fix!
2009-09-22 14:22:34 +02:00
Rainer Gerhards
4cc2db490a bugfixes: potential problems in out file zip writer.
Problems could lead to abort and/or memory leak. The module is now hardened in a very
conservative way, which is sub-optimal from a performance point of view. This should
be improved if it has proven reliable in practice.
2009-09-22 14:07:25 +02:00
Rainer Gerhards
b81c4252e8 Merge branch 'v4-beta' into beta 2009-09-14 15:40:06 +02:00
Rainer Gerhards
92b4f6d610 fixed some minor portability issues 2009-09-14 15:39:16 +02:00
Rainer Gerhards
7d9ad61884 Merge branch 'beta' 2009-08-19 13:04:35 +02:00
Rainer Gerhards
192bc01d9e undid non-correct experimental fix
I found out that the previous segfault fix did not correct the root
cause of the problem. Thus, I can re-instantiate the more performance-
optimal logic. In the next step, I'll merge in the real fix, so do NOT
use this commit as code you actually run!
2009-08-19 12:58:45 +02:00