FS#13728 - [initscripts] minilogd.c always eat memory on buflines>=MAX_BUF_LINES

Attached to Project: Arch Linux
Opened by Gerardo Exequiel Pozzi (djgera) - Tuesday, 10 March 2009, 01:41 GMT
Last edited by Aaron Griffin (phrakture) - Friday, 12 June 2009, 15:45 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Tobias Powalowski (tpowa)
Aaron Griffin (phrakture)
Thomas Bächler (brain0)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description: minilogd always eat memory when buflines>=MAX_BUF_LINES. This is because of the line for reserving memory for "*message" in calloc() @ runDaemon()

Then from my point of view (if no syslogd startup in the system) maybe these solutions:

1) close the /dev/log, then no more conections are accepted, but always check if the /dev/log "times" have been changed, to dump buffer to it.

2) Accept conections like now, but don't reserve memory with calloc() every time for "*message" buffer, so overwrite the message. (only need one calloc() when buflines>=MAX_BUF_LINES, and free() on exit).

3) Another more convenient approach.

For the option the programs thta uses logger functions:
1) see the system as if no logger daemon was loaded (calls to logger funtions returns errors)
2) will log errors, but will be silently ignored.
3) ...


Additional info:
initscripts-2009-NN
Without starting syslog-ng.


NOTE: I don't create a patch for this, leaving open the possibility to implement more you see fit.
This task depends upon

Closed by  Aaron Griffin (phrakture)
Friday, 12 June 2009, 15:45 GMT
Reason for closing:  Implemented
Additional comments about closing:  In git
Comment by Gerardo Exequiel Pozzi (djgera) - Monday, 16 March 2009, 02:55 GMT
Ok i created a very simple patch for this issue.

The idea is:
Log messages are always received/acepted, but these are ignored when MAX_BUF_LINES is reached then: calls only one more time to calloc(), so don't lacks memory and the process don't grow. These messages are "ignored" and overwrited in each new log entry.

Comment by Gerardo Exequiel Pozzi (djgera) - Sunday, 24 May 2009, 20:13 GMT
Removed from previous patch innecessary check for NULL before free() from manpage: "If ptr is NULL, no operation is performed."

Comment by Gerardo Exequiel Pozzi (djgera) - Sunday, 24 May 2009, 20:13 GMT
oops touched bad button, here are the patch:
Comment by Aaron Griffin (phrakture) - Friday, 12 June 2009, 15:45 GMT
Applied and pushed. Thanks

Loading...