Ticket #80 (closed enhancement: wontfix)

Opened 20 months ago

Last modified 18 months ago

Jabberd's memory management doesn't deal with OOM cases

Reported by: sxw Owned by: smoku
Priority: minor Component: General
Version: 2.2 Keywords:
Cc: Tracforge_linkmap:
Blocking: Blocked By:

Description

In lots of locations in the jabberd2 codebase there are code patterns of the form

  str = malloc(1024);
  strcpy(str, "String");

This leads to segmentation faults in situations where malloc() fails due to an out-of-memory error.

Ideally, malloc and friends would be replaced with wrappers which would call malloc, and exit the program gracefully should malloc fail.

I'd be happy to create a patch to do this (sed is my friend :)), if this approach is acceptable.

Change History

Changed 20 months ago by smoku

  • priority changed from major to minor

This is rather low priority bug.

But if you're willing to provide patch, I will gladly review and apply it.

Changed 19 months ago by smoku

  • version changed from 2.1 to 2.2
  • type changed from defect to enhancement

Rethinking this...

Exiting gracefully does not really help with OOM handling. It's a runtime ERROR and should be handled like an error. Dumped core on failure at least gives some backtrace and hints why the OOM happened. Gracefull exit with one line in the log - doesn't.

Maybe we just should catch all the core dumping signals (ABRT, SEGV, ILL, etc.), log a line in logfile that this happened and exit ungracefully dumping the core?

Changed 18 months ago by smoku

  • status changed from new to closed
  • resolution set to wontfix
Note: See TracTickets for help on using tickets.