Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error proding JSON output: "Cannot encode Infinity". #8

Open
vnayar opened this issue Jul 3, 2022 · 0 comments
Open

Error proding JSON output: "Cannot encode Infinity". #8

vnayar opened this issue Jul 3, 2022 · 0 comments

Comments

@vnayar
Copy link

vnayar commented Jul 3, 2022

After compiling in profile mode, running the program, and then running profdump 0.4.3 on the resulting trace.log file, JSON output fails to be produced, although "dot" and "text" still function correctly.

For example, consider the following "trace.log" function "std.array.arrayAllocImpl":

------------------
	   16	_D3std5array__T18uninitializedArrayTAAyaTmZQBcFNaNbmZQr
_D3std5array__T14arrayAllocImplVbi0TAAyaTmZQBcFNaNbmZQr	16	7061	7061
------------------
	    1	_D3std5array__T18uninitializedArrayTAaTmZQBaFNaNbNemZQr
_D3std5array__T14arrayAllocImplVbi0TAaTmZQBaFNaNbmZQp	1	587	587
------------------
	    1	_D3std5array__TQjTSQr5range__T11SortedRangeTAAyaS4vibe4core4args__T10readOptionTQBkZQrFQBqPQBvQBxZ9__lambda5VEQEeQDo18SortedRangeOptionsi0ZQEfZQFhFQEzZ9__lambda6MFNaNbNeZQEw
	    2	_D3std5array__TQjTSQr5range__T11SortedRangeTAAyaS4vibe4core4args__T10readOptionTtZQpFQBoPtQBtZ9__lambda5VEQEaQDk18SortedRangeOptionsi0ZQEbZQFdFQEvZ9__lambda6MFNaNbNeZQEs
	    8	_D3std5array__TQjTSQr5range__T11SortedRangeTAAyaS4vibe4core4args__T10readOptionTQBjZQrFQBqPQBuQBxZ9__lambda5VEQEeQDo18SortedRangeOptionsi0ZQEfZQFhFQEzZ9__lambda6MFNaNbNeZQEw
	    5	_D3std5array__TQjTSQr5range__T11SortedRangeTAAyaS4vibe4core4args__T10readOptionTbZQpFQBoPbQBtZ9__lambda5VEQEaQDk18SortedRangeOptionsi0ZQEbZQFdFQEvZ9__lambda6MFNaNbNeZQEs
_D3std5array__T18uninitializedArrayTAAyaTmZQBcFNaNbmZQr	16	6870	-191
	   16	_D3std5array__T14arrayAllocImplVbi0TAAyaTmZQBcFNaNbmZQr

The profdump output in text mode is as follows:

Function 'immutable(..)[][] std.array.arrayAllocImpl!(..).arrayAllocImpl(..)':
	Mangled name: '_D3std5array__T14arrayAllocImplVbi0TAAyaTmZQBcFNaNbmZQr'
	Called by:
		immutable(..)[][] std.array.uninitializedArray!(..).uninitializedArray(..)	16 times
	Took: 0.007061 seconds (inf%)
	Finished in: 0.007061 seconds (inf%)

Attempting to produce JSON output results in the following error:

Running ../../../.dub/packages/profdump-0.4.3/profdump/profdump -j trace.log profdump.json
std.json.JSONException@std/json.d(1806): Cannot encode Infinity. Consider passing the specialFloatLiterals flag.
----------------
??:? @safe void std.json.toJSON!(std.array.Appender!(immutable(char)[]).Appender).toJSON(ref std.array.Appender!(immutable(char)[]).Appender, ref const(std.json.JSONValue), in bool, in std.json.JSONOptions).toValueImpl(ref const(std.json.JSONValue), ulong) [0x5589a1265dba]
??:? @safe void std.json.toJSON!(std.array.Appender!(immutable(char)[]).Appender).toJSON(ref std.array.Appender!(immutable(char)[]).Appender, ref const(std.json.JSONValue), in bool, in std.json.JSONOptions).toValueImpl(ref const(std.json.JSONValue), ulong).emit!(immutable(char)[][]).emit(immutable(char)[][]) [0x5589a12666de]
??:? @safe void std.json.toJSON!(std.array.Appender!(immutable(char)[]).Appender).toJSON(ref std.array.Appender!(immutable(char)[]).Appender, ref const(std.json.JSONValue), in bool, in std.json.JSONOptions).toValueImpl(ref const(std.json.JSONValue), ulong) [0x5589a1265ad4]
??:? @safe void std.json.toJSON!(std.array.Appender!(immutable(char)[]).Appender).toJSON(ref std.array.Appender!(immutable(char)[]).Appender, ref const(std.json.JSONValue), in bool, in std.json.JSONOptions).toValueImpl(ref const(std.json.JSONValue), ulong) [0x5589a1265b9d]
??:? @safe void std.json.toJSON!(std.array.Appender!(immutable(char)[]).Appender).toJSON(ref std.array.Appender!(immutable(char)[]).Appender, ref const(std.json.JSONValue), in bool, in std.json.JSONOptions).toValueImpl(ref const(std.json.JSONValue), ulong).emit!(immutable(char)[][]).emit(immutable(char)[][]) [0x5589a12666de]
??:? @safe void std.json.toJSON!(std.array.Appender!(immutable(char)[]).Appender).toJSON(ref std.array.Appender!(immutable(char)[]).Appender, ref const(std.json.JSONValue), in bool, in std.json.JSONOptions).toValueImpl(ref const(std.json.JSONValue), ulong) [0x5589a1265ad4]
??:? @safe void std.json.toJSON!(std.array.Appender!(immutable(char)[]).Appender).toJSON(ref std.array.Appender!(immutable(char)[]).Appender, ref const(std.json.JSONValue), in bool, in std.json.JSONOptions) [0x5589a1265951]
??:? @safe immutable(char)[] std.json.toJSON(ref const(std.json.JSONValue), in bool, in std.json.JSONOptions) [0x5589a1265717]
??:? const @safe immutable(char)[] std.json.JSONValue.toPrettyString(in std.json.JSONOptions) [0x5589a12656df]
../../../.dub/packages/profdump-0.4.3/profdump/source/profdump.d:164 const void profdump.Profile.writeJSON(ref std.stdio.File, in float, in bool) [0x5589a120dcb4]
../../../.dub/packages/profdump-0.4.3/profdump/source/app.d:103 _Dmain [0x5589a11ad36e]

The output of "inf%" is unexpected as well as the error when trying to produce output in JSON.

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

No branches or pull requests

1 participant