TrueBlocks / trueblocks-core

The main repository for the TrueBlocks system
https://trueblocks.io
GNU General Public License v3.0
1.05k stars 198 forks source link

Safe keeping #3643

Closed tjayrush closed 4 months ago

tjayrush commented 5 months ago

Someone in our discord reported this:

I was getting a message yesterday that it couldnt findthe block but its working fine now. must be related to how close in time it was to when i rebuilt the indexes [4:29 PM]pigeons:

May 02 20:21:59 ethereum trueblocks-api[3633644]: 2024/05/02 20:21:59 http: panic serving IP_ADDRESS_REDACTED_MANUALLY:53880: runtime error: index out of range [0] with length 0
May 02 20:21:59 ethereum trueblocks-api[3633644]: goroutine 349649 [running]:
May 02 20:21:59 ethereum trueblocks-api[3633644]: net/http.(*conn).serve.func1()
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /usr/local/go/src/net/http/server.go:1854 +0xbf
May 02 20:21:59 ethereum trueblocks-api[3633644]: panic({0xe2c820, 0xc005e8c4c8})
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /usr/local/go/src/runtime/panic.go:890 +0x263
May 02 20:21:59 ethereum trueblocks-api[3633644]: github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types.(*SimpleFunction).Model.func1({0xc007bd7980, 0x1, 0xea0828?})
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /opt/ethereum/trueblocks-core/src/apps/chifra/pkg/types/types_function.go:103 +0xe8
May 02 20:21:59 ethereum trueblocks-api[3633644]: github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types.(*SimpleFunction).Model(0xc002b1af00, {0xc0002499d8, 0x7}, {0xea04e0, 0x4}, 0x1, 0xc0063b2990)
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /opt/ethereum/trueblocks-core/src/apps/chifra/pkg/types/types_function.go:109 +0x356
May 02 20:21:59 ethereum trueblocks-api[3633644]: github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output.StreamMany[...]({0x10bfdb8, 0xc003b15900}, 0xc0063b2870, {0x0, 0x1, 0x0, {0xea04e0, 0x4}, {0xe9f693, 0x2}, ...})
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /opt/ethereum/trueblocks-core/src/apps/chifra/pkg/output/stream.go:168 +0x6c2
May 02 20:21:59 ethereum trueblocks-api[3633644]: github.com/TrueBlocks/trueblocks-core/src/apps/chifra/internal/abis.(*AbisOptions).HandleShow(0xc00014e500)
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /opt/ethereum/trueblocks-core/src/apps/chifra/internal/abis/handle_show.go:57 +0x357
May 02 20:21:59 ethereum trueblocks-api[3633644]: github.com/TrueBlocks/trueblocks-core/src/apps/chifra/internal/abis.(*AbisOptions).AbisInternal(0xc00014e500)
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /opt/ethereum/trueblocks-core/src/apps/chifra/internal/abis/output.go:62 +0xd5
May 02 20:21:59 ethereum trueblocks-api[3633644]: github.com/TrueBlocks/trueblocks-core/src/apps/chifra/internal/abis.ServeAbis({0x10bf570?, 0xc001935a40}, 0x3ff0000000000000?)
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /opt/ethereum/trueblocks-core/src/apps/chifra/internal/abis/output.go:40 +0x8f
May 02 20:21:59 ethereum trueblocks-api[3633644]: github.com/TrueBlocks/trueblocks-core/src/apps/chifra/internal/daemon.RouteAbis({0x10bf570, 0xc001935a40}, 0x490e17?)
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /opt/ethereum/trueblocks-core/src/apps/chifra/internal/daemon/routes.go:78 +0x25
May 02 20:21:59 ethereum trueblocks-api[3633644]: net/http.HandlerFunc.ServeHTTP(0x1?, {0x10bf570?, 0xc001935a40?}, 0x1?)
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /usr/local/go/src/net/http/server.go:2122 +0x2f
May 02 20:21:59 ethereum trueblocks-api[3633644]: github.com/TrueBlocks/trueblocks-core/src/apps/chifra/internal/daemon.Logger.func1({0x10bf570, 0xc001935a40}, 0xc001a8ea00)
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /opt/ethereum/trueblocks-core/src/apps/chifra/internal/daemon/routes.go:347 +0xcd
May 02 20:21:59 ethereum trueblocks-api[3633644]: net/http.HandlerFunc.ServeHTTP(0xe08d00?, {0x10bf570?, 0xc001935a40?}, 0xc?)
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /usr/local/go/src/net/http/server.go:2122 +0x2f
May 02 20:21:59 ethereum trueblocks-api[3633644]: github.com/TrueBlocks/trueblocks-core/src/apps/chifra/internal/daemon.ContentTypeHandler.func1({0x10bf570, 0xc001935a40}, 0xc001a8ea00)
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /opt/ethereum/trueblocks-core/src/apps/chifra/internal/daemon/routes.go:332 +0x187
May 02 20:21:59 ethereum trueblocks-api[3633644]: net/http.HandlerFunc.ServeHTTP(0x10bf570?, {0x10bf570?, 0xc001935a40?}, 0x10bfe60?)
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /usr/local/go/src/net/http/server.go:2122 +0x2f
May 02 20:21:59 ethereum trueblocks-api[3633644]: github.com/TrueBlocks/trueblocks-core/src/apps/chifra/internal/daemon.CorsHandler.func1({0x10bf570, 0xc001935a40}, 0xc001ecc6c0?)
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /opt/ethereum/trueblocks-core/src/apps/chifra/internal/daemon/routes.go:312 +0x5c
May 02 20:21:59 ethereum trueblocks-api[3633644]: net/http.HandlerFunc.ServeHTTP(0xc001a8e900?, {0x10bf570?, 0xc001935a40?}, 0x800?)
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /usr/local/go/src/net/http/server.go:2122 +0x2f
May 02 20:21:59 ethereum trueblocks-api[3633644]: github.com/gorilla/mux.(*Router).ServeHTTP(0xc0002300c0, {0x10bf570, 0xc001935a40}, 0xc001a8e700)
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /opt/ethereum/go/pkg/mod/github.com/gorilla/mux@v1.8.0/mux.go:210 +0x1cf
May 02 20:21:59 ethereum trueblocks-api[3633644]: net/http.serverHandler.ServeHTTP({0xc001ecc450?}, {0x10bf570, 0xc001935a40}, 0xc001a8e700)
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /usr/local/go/src/net/http/server.go:2936 +0x316
May 02 20:21:59 ethereum trueblocks-api[3633644]: net/http.(*conn).serve(0xc004c963f0, {0x10bfe60, 0xc000691f20})
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /usr/local/go/src/net/http/server.go:1995 +0x612
May 02 20:21:59 ethereum trueblocks-api[3633644]: created by net/http.(*Server).Serve
May 02 20:21:59 ethereum trueblocks-api[3633644]:         /usr/local/go/src/net/http/server.go:3089 +0x5ed

It's very hard to reproduce, I'm sure, but perhaps there's an easy fix if we checkout the stack trace.

danrmiller commented 5 months ago

I'm sorry for the confusion, this is a separate issue to "I was getting a message yesterday that it couldn't find the block but its working fine now. must be related to how close in time it was to when i rebuilt the indexes."

This issue happens I think on an call to chifra abis and can be reproduced, I think it relates to proxy contracts. I will provide more info.

tjayrush commented 5 months ago

Thanks. I appreciate your help.

On Thu, May 2, 2024 at 6:49 PM Dan Miller @.***> wrote:

I'm sorry for the confusion, this is a separate issue to "I was getting a message yesterday that it couldn't find the block but its working fine now. must be related to how close in time it was to when i rebuilt the indexes."

This issue happens I think on an call to chifra abis and can be reproduced, I think it relates to proxy contracts. I will provide more info.

— Reply to this email directly, view it on GitHub https://github.com/TrueBlocks/trueblocks-core/issues/3643#issuecomment-2091872660, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABJKXPSV2K4AIEVSFI6ZYTDZAK7IXAVCNFSM6AAAAABHEP7FDCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJRHA3TENRWGA . You are receiving this because you authored the thread.Message ID: @.***>

-- Thomas Jay Rush http://t http://quickblocks.iorueblocks.io @.***

danrmiller commented 5 months ago

The error is from chifa serve when requesting an abi with verbose=true. Without the verbose flag the abi info is returned fine. I don't see the verbose flag here anymore https://trueblocks.io/api/#tag/Accounts/operation/accounts-abis but it is listed for the CLI https://trueblocks.io/chifra/accounts/#chifra-abis. I think the options for the cli and the http api used to match 1:1 but perhaps no more. I notice from the CLI I get the same results verbose or not, and without verbose it has the information I need, so I will stop using that flag via http.

tjayrush commented 5 months ago

Thanks so much for submitting this. I'll try to fix this one for version 3.0.0.

May I ask you what "information you need?"

This issue has been fixed in the lastest branch which will be merged into develop shortly. Trouble is, develop is in a bit of a state of flux as we move to version 3.0.0, so there may be breaking changes.

The line that needs correcting is this one in this file: /opt/ethereum/trueblocks-core/src/apps/chifra/pkg/types/types_function.go

Existing line:

result := make([]map[string]any, 0, len(params))

Should be:

result := make([]map[string]any, len(params))