RPC documentation crashes
Describe the bug
Clicking on some entries in the RPC documentation at https://docs.forest.chainsafe.io/docs/users/reference/json-rpc-api makes it crash, for example EthEstimateGas.
To reproduce
- Go to https://forest-docs-v2.pages.dev/docs/users/reference/filecoin.ethestimategas
- See the docs crashing.
Expected behaviour
Docs don't crash. What is This operation is insecure?
Screenshots
Environment (please complete the following information):
- OS: Fedora Linux 40 (Workstation Edition)
- Branch/commit latest main af5d2344a0216f860eb4c48b2625b84ae26abf1f
- Browser: Mozilla Firefox for Fedora 134.0 (64-bit)
Other information and links
@ansermino Any quick immediate thoughts here?
I was able to reproduce this in Firefox, it does not present in Chromium. This seems to be caused by too many changes to the DOM in a short period. You can observe the URL params repeatedly change before the error shows. It is not present on the handful of other methods I checked.
I wasn't aware URL params were used by the library, we should investigate their intended purpose.
As a hot fix - lets remove this method from the OpenRPC document currently used to generate the docs. We could also generate a new document and see if the issue is still present.
Firefox logs
Too many calls to Location or History APIs within a short timeframe. 2 main.212c899a.js:2:159176 DOMException: The operation is insecure.
When generating a new document with ❯ forest-tool shed openrpc --path v1 > docs/docs/users/openrpc.json I get:
- unsupported version
1.3.2. I manually changed it to1.2.6in the generated spec (not sure if it's okay, probably not?) - Out of memory when starting with
yarn startwith the new spec with manually modified version.
❯ yarn start
[INFO] Starting the development server...
Warn: `blogDir` doesn't exist: "/home/rumcajs/prj/forest/docs/blog".
<--- Last few GCs --->
[87902:0x55c9d33d0950] 35550 ms: Mark-Compact 4046.4 (4133.1) -> 4031.6 (4134.4) MB, 1626.16 / 0.00 ms (average mu = 0.093, current mu = 0.006) allocation failure; scavenge might not succeed
[87902:0x55c9d33d0950] 37186 ms: Mark-Compact 4047.8 (4134.6) -> 4033.0 (4135.6) MB, 1629.73 / 0.00 ms (average mu = 0.050, current mu = 0.004) allocation failure; scavenge might not succeed
<--- JS stacktrace --->
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----
1: 0x7fc4532e4e91 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [/lib64/libnode.so.115]
2: 0x7fc454c96b64 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/lib64/libnode.so.115]
3: 0x7fc454c96f5f v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [/lib64/libnode.so.115]
4: 0x7fc454ec4ecb [/lib64/libnode.so.115]
5: 0x7fc454ec4f4b [/lib64/libnode.so.115]
6: 0x7fc454eddc60 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*) [/lib64/libnode.so.115]
7: 0x7fc454ede760 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/lib64/libnode.so.115]
8: 0x7fc454eb780c v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/lib64/libnode.so.115]
9: 0x7fc454eb8e28 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/lib64/libnode.so.115]
10: 0x7fc454e9760f v8::internal::Factory::NewFillerObject(int, v8::internal::AllocationAlignment, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/lib64/libnode.so.115]
11: 0x7fc45536a9e0 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/lib64/libnode.so.115]
12: 0x7fc3f4b19ef6
Any known workarounds? Perhaps @elmattic or @sudo-shashank ?
OOM might be the same as the one mentioned in https://github.com/elmattic/openrpc-checker/blob/main/SUMMARY.md#forest-openrpc-document
Consider writing own RPC method viewer if dependency proves to be problematic.