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

WIP - do not merge - 0.26 leak detection #2031

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion go/common/compression/data_compression_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ func (cs *brotliDataCompressionService) Decompress(in []byte) ([]byte, error) {

func (cs *brotliDataCompressionService) compress(in []byte, level int) ([]byte, error) {
var buf bytes.Buffer
writer := brotli.NewWriterLevel(&buf, level)
// writer := brotli.NewWriterLevel(&buf, level)
writer := brotli.NewWriterV2(&buf, level)
_, err := writer.Write(in)
if closeErr := writer.Close(); err == nil {
err = closeErr
Expand Down
26 changes: 26 additions & 0 deletions go/enclave/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ package main

import (
"fmt"
"os"
"runtime/pprof"
"time"

"github.com/ten-protocol/go-ten/go/common/container"
tenflag "github.com/ten-protocol/go-ten/go/common/flag"
Expand All @@ -25,6 +28,29 @@ func main() {
panic(fmt.Errorf("unable to create config from flags - %w", err))
}

// temporary code to help identify OOM
go func() {
for {
heap, err := os.Create(fmt.Sprintf("/data/heap_%d.pprof", time.Now().UnixMilli()))
if err != nil {
panic(fmt.Errorf("could not open heap profile: %w", err))
}
err = pprof.WriteHeapProfile(heap)
if err != nil {
panic(fmt.Errorf("could not write CPU profile: %w", err))
}
stack, err := os.Create(fmt.Sprintf("/data/stack_%d.pprof", time.Now().UnixMilli()))
if err != nil {
panic(fmt.Errorf("could not open stack profile: %w", err))
}
err = pprof.Lookup("goroutine").WriteTo(stack, 1)
if err != nil {
panic(fmt.Errorf("could not write CPU profile: %w", err))
}
time.Sleep(1 * time.Hour)
}
}()

enclaveContainer := enclavecontainer.NewEnclaveContainerFromConfig(enclaveConfig)
container.Serve(enclaveContainer)
}
3 changes: 2 additions & 1 deletion go/host/enclave/guardian.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,8 @@ func (g *Guardian) submitL1Block(block *common.L1Block, isLatest bool) (bool, er
// nullify all non-relevant transactions
txs := block.Transactions()
for i, rec := range receipts {
if rec == nil {
// the FetchObscuroReceipts method returns dummy receipts on non-relevant positions.
if rec.BlockNumber == nil {
txs[i] = nil
}
}
Expand Down