log_mf_h can't store problem reports above 64K bytes (With patch)

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

log_mf_h can't store problem reports above 64K bytes (With patch)

Jesper Louis Andersen
Release: OTP-R11b-5
Operating system: All

Problem description:

When the STDLIB module log_mf_h stores a problem report in the on-disk
round-robin database, it can't store a problem report above a size of
64Kilobytes[*]. The reason is that the format used is to encode the report
is (bit-syntax notation)

<<Size:16/integer, Report/binary>>

So since 2^16 = 64K, trying to store a larger problem report fails. Then,
when the SASL module 'rb' tries to read the problem report, it fails becase
the report has the wrong size.

Problem solution:

The attached patch changes the code so it
** Uses bit syntax rather than old peek/poke
** Uses a 4 byte size field rather than a 2 byte size field.

Solution considerations:

The patch will make all old log_mf_h logs on-disk unreadable. There is no
upgrade path incorporated.

With a 32-bit integer word, it is possible to write enormously large
error-reports to disk. Several gigabytes at least.

Solution alternatives:

Use a 3-byte field. Not because of space, but because it is then a 8/16Mb
report that can be written which makes the second consideration much more

Use list_to_binary(Bin, [compressed]). We would save some space and trade
Disk I/O for CPU cycles. However, I don't know how well that is supported in
the system.

[*] Maybe this is only 32 kilobytes because of signedness
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20070821/ed8ab8a1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: log_mf_h.patch
Type: text/x-patch
Size: 3241 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20070821/ed8ab8a1/attachment.bin>