Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

[dev.icinga.com #11221] trends.cgi segfault while reading log files #1575

Closed
icinga-migration opened this issue Feb 24, 2016 · 3 comments
Closed

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/11221

Created by mfriedrich on 2016-02-24 15:59:57 +00:00

Assignee: ricardo
Status: Resolved (closed on 2016-07-18 21:05:23 +00:00)
Target Version: 1.14
Last Update: 2016-07-18 21:05:23 +00:00 (in Redmine)

Icinga Version: 1.13.3
OS Version: SLES11 SP3

/var/log/icinga2/compat/archives contains 10000 files with an hourly rotation.

For some reason the loop reading the files calls my_free() on an empty string which then results in a segfault.
https://github.com/Icinga/icinga-core/blob/master/cgi/readlogs.c#L291

@ricardo
Since you've rewritten those code parts lately, can you have a look please?

Program received signal SIGABRT, Aborted.
0x00007ffff697a885 in raise () from /lib64/libc.so.6
(gdb) bt

#0 0x00007ffff697a885 in raise () from /lib64/libc.so.6
#1 0x00007ffff697be61 in abort () from /lib64/libc.so.6
#2 0x00007ffff69bb88f in __libc_message () from /lib64/libc.so.6
#3 0x00007ffff69c1098 in malloc_printerr () from /lib64/libc.so.6
#4 0x00007ffff69c60dc in free () from /lib64/libc.so.6
#5 0x00000000004142e7 in get_log_entries (entry_list=0x7fffffffc160, filter_list=0x7fffffffc158, error_text=0x7fffffffc168, search_string=0x0, reverse=0,

ts_start=1456208606, ts_end=1456323806) at readlogs.c:308

#6 0x0000000000404fd4 in read_archived_state_data () at trends.c:2332
#7 0x00000000004066b5 in main (argc=, argv=) at trends.c:774

(gdb) up

#1 0x00007ffff697be61 in abort () from /lib64/libc.so.6

(gdb)

#2 0x00007ffff69bb88f in __libc_message () from /lib64/libc.so.6

(gdb)

#3 0x00007ffff69c1098 in malloc_printerr () from /lib64/libc.so.6

(gdb)

#4 0x00007ffff69c60dc in free () from /lib64/libc.so.6

(gdb)

#5 0x00000000004142e7 in get_log_entries (entry_list=0x7fffffffc160, filter_list=0x7fffffffc158, error_text=0x7fffffffc168, search_string=0x0, reverse=0,

ts_start=1456208606, ts_end=1456323806) at readlogs.c:308
308 my_free(files[i].file_name);
(gdb) l
303
304 last_timestamp = timestamp;
305 }
306
307 /* free file entry and set to NULL. if valid file is found, entry gets refilled */
308 my_free(files[i].file_name);
309
310 /* we found data and we are out of range again, file must be older then ts_start. stop checking files */
311 if (data_found TRUE && in_range FALSE)
312 continue;
(gdb)

Attachments

Changesets

2016-06-23 21:46:24 +00:00 by ricardo a517a1b

Classic UI: fix segfault if num log files exceeds max amount #11221

When I decided on max 10000 log files, I didn't take the hourly
logging into account. And poor programming skills caused
this to segfault.

Now the maximum amount of readable log files is set to
87600 which is 10 years of log files on hourly rotation.

Refs: #11221
Refs: #12005
Whatthecommit: Things went wrong...

Relations:

@icinga-migration
Copy link
Author

Updated by ricardo on 2016-06-23 22:29:42 +00:00

  • Target Version set to 1.14
  • Done % changed from 0 to 100

fixed in a517a1b.

Cheers
Ricardo

@icinga-migration
Copy link
Author

Updated by ricardo on 2016-07-13 22:49:21 +00:00

  • Duplicated set to 12005

@icinga-migration
Copy link
Author

Updated by ricardo on 2016-07-18 21:05:23 +00:00

  • Status changed from Feedback to Resolved

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant