mozilla / Snappy-Symbolication-Server

https://wiki.mozilla.org/Snappy_Symbolication_Server
Mozilla Public License 2.0
3 stars 12 forks source link

new module index not used in DiskCache request #70

Closed hcs64 closed 7 years ago

hcs64 commented 7 years ago

When a frame is added to a subRequest, its module index needs to be adjusted. This is done when the module was already in the subRequest, but not when a new module is first added to the subRequest.

With an empty memcached, run: curl -d '{"memoryMap":[["psapi.pdb","0CABCB9659614C45A750FC85662A63D62"],["firefox.pdb","2616B6BE149849559089F911259EB1782"],["xul.pdb","92DDE024A3DE4E4AA3DE349708DDECE52"]],"version":4,"stacks":[[[2,11808545]]]}' http://localhost:8080

response: {"symbolicatedStacks": [["0xb42f21 (in xul.pdb)"]], "knownModules": [false, false, false]}

expected response: {"symbolicatedStacks": [["mozilla::`anonymous namespace'::RunWatchdog (in xul.pdb)"]], "knownModules": [false, false, true]}

SymServer log:

ERROR   11086   33315777-7e4f-44ce-a590-ef1774cc8527 Exception when querying DiskCache: HTTP Error 400: Bad Request
ERROR   11086   33315777-7e4f-44ce-a590-ef1774cc8527 Bad response from DiskCache

DiskCache log:

DEBUG   11085   e52fd5c4-57c9-476d-a66f-24c28c05f406 Request body: {"memoryMap": [["xul.pdb", "92DDE024A3DE4E4AA3DE349708DDECE52"]], "version": 4, "stacks": [[[2, 11808545]]]} REMOTE IP=127.0.0.1
DEBUG   11085   e52fd5c4-57c9-476d-a66f-24c28c05f406 A stack frame module index is out of range REMOTE IP=127.0.0.1
ERROR   11085   e52fd5c4-57c9-476d-a66f-24c28c05f406 Unable to validate request body REMOTE IP=127.0.0.1

This isn't only an issue when unused modules are included; if the first frames to use each module aren't in the same order as the modules, some frames will get the wrong module index.

curl -d '{"memoryMap":[["xul.pdb","92DDE024A3DE4E4AA3DE349708DDECE52"],["nss3.pdb","5C90F82AD1304422925B7B2A2E6299992"],["ucrtbase.pdb","973204DF2ECB47D8A3690DFC6F2DD5A91"],["ntdll.pdb","6192BFDB9F04442995FFCB0BE95172E12"],["kernel32.pdb","9B30FD7CD6B44975BF34B43B6EF668212"]],"version":4,"stacks":[[[0,11808545],[1,602045],[1,550681],[2,117423],[4,91436],[3,181536],[4,627439],[4,627439]]]}' http://localhost:8080

result: {"symbolicatedStacks": [["mozilla::`anonymous namespace'::RunWatchdog (in xul.pdb)", "PR_NativeRunThread (in nss3.pdb)", "pr_root (in nss3.pdb)", "o__realloc_base (in ucrtbase.pdb)", "TppWaitpExecuteCallback (in ntdll.pdb)", "GetModuleHandleW (in kernel32.pdb)", "BasepReportFault (in kernel32.pdb)", "BasepReportFault (in kernel32.pdb)"]], "knownModules": [true, true, true, true, true]}

expected result (compare the last three frames): {"symbolicatedStacks": [["mozilla::`anonymous namespace'::RunWatchdog (in xul.pdb)", "PR_NativeRunThread (in nss3.pdb)", "pr_root (in nss3.pdb)", "o__realloc_base (in ucrtbase.pdb)", "BaseThreadInitThunk (in kernel32.pdb)", "RtlUserThreadStart (in ntdll.pdb)", "BasepReportFault (in kernel32.pdb)", "BasepReportFault (in kernel32.pdb)"]], "knownModules": [true, true, true, true, true]}

due to this mis-indexed request visible in the SymServer log: DEBUG 11497 d38aba3d-01c6-4f4a-afe2-7584878daba0 Sending request to DiskCache: {'memoryMap': [(u'xul.pdb', u'92DDE024A3DE4E4AA3DE349708DDECE52'), (u'nss3.pdb', u'5C90F82AD1304422925B7B2A2E6299992'), (u'ucrtbase.pdb', u'973204DF2ECB47D8A3690DFC6F2DD5A91'), (u'kernel32.pdb', u'9B30FD7CD6B44975BF34B43B6EF668212'), (u'ntdll.pdb', u'6192BFDB9F04442995FFCB0BE95172E12')], 'version': 4, 'stacks': [[[0, 11808545], [1, 602045], [1, 550681], [2, 117423], [4, 91436], [3, 181536], [3, 627439], [3, 627439]]]}