mbenkmann / limux-gosa

GOsa² is a web based adminstration tool for user accounts, groups, servers, clients, and many other things.
18 stars 5 forks source link

Memory leak when logging large DEBUG messages #103

Open mbenkmann opened 9 years ago

mbenkmann commented 9 years ago

From matthias...@gmail.com on March 25, 2013 07:30:27

Some DEBUG! messages are very large because they contain complete request or answer texts. Because util.Log() generates a Go string for each message with Sprintf() these large memory blocks leak. To fix, rewrite util.Log() so that:

1) Instead of using a log.Logger as util.Logger, simply use an ordinary io.Writer.

2) Use bytes.Buffer.Printf() to format the log message and bytes.Buffer.WriteTo() to write it to the log.

Original issue: http://code.google.com/p/go-susi/issues/detail?id=103

mbenkmann commented 9 years ago

From matthias...@gmail.com on April 02, 2013 10:58:52

Issue #104 and issue #105 need to be fixed first, because otherwise it is hard to create large DEBUG messages without triggering any other memory leak issues.

In any case, with the latest changes this issue is not critical anymore. go-susi will run fine for a long time even on loglevel DEBUG. Since this is not the recommended setting for production use anyway, I'm downgrading this to a wishlist item.

Status: DontWaitForIt
Labels: -Priority-Want -Milestone-3 Priority-Bonus

mbenkmann commented 9 years ago

From matthias...@gmail.com on April 02, 2013 12:16:31

The DEBUG output in go-susi.go:handle_request() has been changed to no longer include the reply. That should take care of the biggest problems.