Skip to content

Problem with generateId on macOS PHP 7.0, 7.1 #86

@ghost

Description

I have a weird problem which seems to only affect PHP versions (of MAMP) on macOS where the trace ID is always 10000000000000001. I have tested with 7.0.33 and 7.1.32, both have the issue. 7.2.22 is not affected. Also other operating system versions (at least Alpine Linux and Debian) are seemingly not affected.

Jaeger has the method

private function generateId(){
    return microtime(true) * 10000 . rand(10000, 99999);
}

In the mentioned environments this produces e.g. 1.58375696973E+1330420 a very large number that cannot be processed. It seems that on that systems microtime(true) * 10000 is in exponent notation 1.58375693969E+13 and then the rand part is concatenated to the exponent yielding that large number.

On not affected systems the output is the correct e.g. 1583757054325111449.

I have tried to work around the problem but I don't know enough about how trace IDs have to be composed. I get a lot of zeros in the middle which then show up in JaegerUI too.

Do you see the possibility of modifying the method to work around that PHP bug (or whatever it is) on the mentioned systems?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions