aboutsummaryrefslogtreecommitdiffstats
path: root/lib/observer/src/crashdump_viewer.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2011-03-03 17:20:23 +0100
committerSiri Hansen <[email protected]>2011-03-03 17:20:23 +0100
commit5186790d6df4ec0616721f730203e63fc0b627fd (patch)
tree737409b13505125d5a19902def4d39d4eee2006b /lib/observer/src/crashdump_viewer.erl
parent910a25b6502150014ccbd71080d1363461406618 (diff)
downloadotp-5186790d6df4ec0616721f730203e63fc0b627fd.tar.gz
otp-5186790d6df4ec0616721f730203e63fc0b627fd.tar.bz2
otp-5186790d6df4ec0616721f730203e63fc0b627fd.zip
Bugfix: Never deliver empty chunk to inets
Diffstat (limited to 'lib/observer/src/crashdump_viewer.erl')
-rw-r--r--lib/observer/src/crashdump_viewer.erl31
1 files changed, 20 insertions, 11 deletions
diff --git a/lib/observer/src/crashdump_viewer.erl b/lib/observer/src/crashdump_viewer.erl
index bf4910445b..3b8d17c7d9 100644
--- a/lib/observer/src/crashdump_viewer.erl
+++ b/lib/observer/src/crashdump_viewer.erl
@@ -1242,9 +1242,9 @@ indexify(Fd,Bin,N) ->
{Chunk,N1} =
case binary:last(Bin) of
$\n ->
- {<<$\n,Chunk0/binary>>,N+size(Bin)-1};
+ {<<$\n,Chunk0/binary>>,N+byte_size(Bin)-1};
_ ->
- {Chunk0,N+size(Bin)}
+ {Chunk0,N+byte_size(Bin)}
end,
indexify(Fd,Chunk,N1);
eof ->
@@ -2244,9 +2244,13 @@ atoms(SessionId,File,TW,Num) ->
[{_Id,Start}] ->
Fd = open(File),
pos_bof(Fd,Start),
- {Atoms,Cont} = get_atoms(Fd,1000),
- crashdump_viewer_html:atoms(SessionId,TW,Num,Atoms),
- atoms_chunks(Fd,SessionId,Cont);
+ case get_atoms(Fd,?items_chunk_size) of
+ {Atoms,Cont} ->
+ crashdump_viewer_html:atoms(SessionId,TW,Num,Atoms),
+ atoms_chunks(Fd,SessionId,Cont);
+ done ->
+ crashdump_viewer_html:atoms(SessionId,TW,Num,done)
+ end;
_ ->
crashdump_viewer_html:atoms(SessionId,TW,Num,done)
end.
@@ -2254,20 +2258,25 @@ atoms(SessionId,File,TW,Num) ->
get_atoms(Fd,Number) ->
case get_n_lines_of_tag(Fd,Number) of
{all,_,Lines} ->
+ close(Fd),
{Lines,done};
{part,_,Lines} ->
{Lines,Number};
empty ->
- {[],done}
+ close(Fd),
+ done
end.
-atoms_chunks(Fd,SessionId,done) ->
- close(Fd),
+atoms_chunks(_Fd,SessionId,done) ->
crashdump_viewer_html:atoms_chunk(SessionId,done);
atoms_chunks(Fd,SessionId,Number) ->
- {Atoms,Cont} = get_atoms(Fd,Number),
- crashdump_viewer_html:atoms_chunk(SessionId,Atoms),
- atoms_chunks(Fd,SessionId,Cont).
+ case get_atoms(Fd,Number) of
+ {Atoms,Cont} ->
+ crashdump_viewer_html:atoms_chunk(SessionId,Atoms),
+ atoms_chunks(Fd,SessionId,Cont);
+ done ->
+ atoms_chunks(Fd,SessionId,done)
+ end.
%%-----------------------------------------------------------------