Skip to content

Instantly share code, notes, and snippets.

@prashantv
prashantv / gist:5e00eb5e6dc9215c280d7cb30a68cf26
Created January 9, 2023 18:52
terraform destroy triggers CustomizeDiff trace log
cd repro && CUSTOMIZE_DIFF_PANIC=1 terraform destroy
2023-01-09T10:52:39.474-0800 [INFO] Terraform version: 1.2.9
2023-01-09T10:52:39.474-0800 [DEBUG] using github.com/hashicorp/go-tfe v1.0.0
2023-01-09T10:52:39.474-0800 [DEBUG] using github.com/hashicorp/hcl/v2 v2.12.0
2023-01-09T10:52:39.474-0800 [DEBUG] using github.com/hashicorp/terraform-config-inspect v0.0.0-20210209133302-4fd17a0faac2
2023-01-09T10:52:39.474-0800 [DEBUG] using github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734
2023-01-09T10:52:39.474-0800 [DEBUG] using github.com/zclconf/go-cty v1.11.0
2023-01-09T10:52:39.474-0800 [INFO] Go runtime version: go1.18.1
2023-01-09T10:52:39.474-0800 [INFO] CLI args: []string{"terraform", "destroy"}
2023-01-09T10:52:39.474-0800 [TRACE] Stdout is not a terminal
@prashantv
prashantv / elfsym.go
Created September 2, 2021 02:56
elf symbol lookup file offset
package elfsym
import (
"bytes"
"debug/elf"
"fmt"
"io/ioutil"
)
type Symbol struct {
@prashantv
prashantv / stuck-timer-repro.go
Created April 23, 2021 04:33
runtime timers stop firing when GOMAXPROCS is reduced
package main
import (
"fmt"
"runtime"
"sync"
"time"
)
func main() {
"prashant"
2019/07/22 17:38:58 http2: Transport creating client conn 0xc0000f0000 to 127.0.0.1:34071
2019/07/22 17:38:58 http2: Framer 0xc00011a000: wrote SETTINGS len=18, settings: ENABLE_PUSH=0, INITIAL_WINDOW_SIZE=4194304, MAX_HEADER_LIST_SIZE=10485760
2019/07/22 17:38:58 http2: Framer 0xc00011a000: wrote WINDOW_UPDATE len=4 (conn) incr=1073741824
2019/07/22 17:38:58 http2: Transport encoding header ":authority" = "127.0.0.1:34071"
2019/07/22 17:38:58 http2: Transport encoding header ":method" = "POST"
2019/07/22 17:38:58 http2: Transport encoding header ":path" = "/drop"
2019/07/22 17:38:58 http2: Transport encoding header ":scheme" = "http"
2019/07/22 17:38:58 http2: Transport encoding header "content-type" = "application/raw"
2019/07/22 17:38:58 http2: Transport encoding header "content-length" = "8388608"
2019/07/22 17:38:58 http2: Transport encoding header "accept-encoding" = "gzip"
Microsoft (R) Windows Debugger Version 10.0.17763.132 AMD64
Copyright (c) Microsoft Corporation. All rights reserved.
Loading Dump File [C:\Users\Prashant\Documents\032119-18390-01.dmp]
Mini Kernel Dump File: Only registers and stack trace are available
WARNING: Whitespace at end of path element
Error: Empty Path.
@prashantv
prashantv / gist:06466e39848e6516f0a706aea16bdfd8
Created January 29, 2019 06:04
tchannel close states / transitions
Close
close("user initiated")
close
sets state to connectionStartClose
causes checkExchanges to go to close states
readFrames:
connectionError if closeNetwork ISNT called
2018/12/07 18:19:24 h2c: attempting h2c with prior knowledge.
2018/12/07 18:19:24 http2: server connection from [::1]:43354 on 0xc42008d860
2018/12/07 18:19:24 http2: Framer 0xc4209dc380: wrote SETTINGS len=24, settings: MAX_FRAME_SIZE=1048576, MAX_CONCURRENT_STREAMS=250, MAX_HEADER_LIST_SIZE=1048896, INITIAL_WINDOW_SIZE=1048576
2018/12/07 18:19:24 http2: server: client [::1]:43354 said hello
2018/12/07 18:19:24 http2: Framer 0xc4209dc380: wrote WINDOW_UPDATE len=4 (conn) incr=983041
2018/12/07 18:19:24 http2: Framer 0xc4209dc000: wrote SETTINGS len=0
2018/12/07 18:19:24 http2: Framer 0xc4209dc380: read SETTINGS len=0
2018/12/07 18:19:24 http2: server read frame SETTINGS len=0
2018/12/07 18:19:24 http2: Framer 0xc4209dc380: wrote SETTINGS flags=ACK len=0
2018/12/07 18:19:24 http2: Framer 0xc4209dc000: read SETTINGS len=24, settings: MAX_FRAME_SIZE=1048576, MAX_CONCURRENT_STREAMS=250, MAX_HEADER_LIST_SIZE=1048896, INITIAL_WINDOW_SIZE=1048576
package main
import (
"fmt"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
lumberjack "gopkg.in/natefinch/lumberjack.v2"
"time"
)
> go test -bench .
goos: darwin
goarch: amd64
pkg: go.uber.org/atomic
BenchmarkStress/u32/std/serial-8 50000000 42.0 ns/op
BenchmarkStress/u32/std/parallel-8 10000000 173 ns/op
BenchmarkStress/u32/serial-8 30000000 42.9 ns/op
BenchmarkStress/u32/parallel-8 10000000 173 ns/op
BenchmarkStress/f64/serial-8 30000000 46.3 ns/op
BenchmarkStress/f64/parallel-8 5000000 359 ns/op