Shopify / themekit

Shopify theme development command line tool.
https://shopify.dev/tools/theme-kit
MIT License
1.2k stars 375 forks source link

Invalid memory address #810

Closed pcook2 closed 4 years ago

pcook2 commented 4 years ago

Describe the bug panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x145c8f2]

To Reproduce Steps to reproduce the behavior:

  1. run command 'theme watch'
  2. keep watching for more than 1 hour

Expected behavior It should not crash

Environment (please complete the following information):

Additional context It crashes even when only one theme is watched.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x145c8f2]

goroutine 59 [running]:
github.com/Shopify/themekit/src/httpify.(*HTTPClient).doWithRetry(0xc0003060c0, 0xc00022b000, 0x14ee800, 0xc000376150, 0x1, 0xc0003f40b0, 0x0)
    /Users/andyw8/src/github.com/Shopify/themekit/src/httpify/client.go:130 +0x102
github.com/Shopify/themekit/src/httpify.(*HTTPClient).do(0xc0003060c0, 0x15775a6, 0x3, 0xc000027ec0, 0x33, 0x14ee800, 0xc000376150, 0xc0003760c0, 0x100cead, 0x1556e60, ...)
    /Users/andyw8/src/github.com/Shopify/themekit/src/httpify/client.go:105 +0x5d1
github.com/Shopify/themekit/src/httpify.(*HTTPClient).Put(0xc0003060c0, 0xc000027ec0, 0x33, 0x14ee800, 0xc000376150, 0xc0003760c0, 0xd, 0x19fa1e0, 0x0)
    /Users/andyw8/src/github.com/Shopify/themekit/src/httpify/client.go:82 +0x7f
github.com/Shopify/themekit/src/shopify.Client.UpdateAsset(0xc0002f0390, 0xc, 0xc00002a420, 0x2a, 0x19dd860, 0xd, 0xd, 0x19fa1e0, 0x0, 0x0, ...)
    /Users/andyw8/src/github.com/Shopify/themekit/src/shopify/theme_client.go:293 +0x1fd
github.com/Shopify/themekit/cmd.perform(0xc0000ceb40, 0xc000450000, 0x18, 0x0, 0xc000681760, 0x20)
    /Users/andyw8/src/github.com/Shopify/themekit/cmd/watch.go:123 +0xa44
github.com/Shopify/themekit/cmd.watch(0xc0000ceb40, 0xc00020f140, 0xc00020f1a0, 0x167bf00, 0x19fa450, 0x0, 0x0)
    /Users/andyw8/src/github.com/Shopify/themekit/cmd/watch.go:86 +0x6d7
github.com/Shopify/themekit/cmd.glob..func12.1(0xc0000ceb40, 0x0, 0x0)
    /Users/andyw8/src/github.com/Shopify/themekit/cmd/watch.go:58 +0x302
github.com/Shopify/themekit/src/cmdutil.forEachClient.func1(0x8, 0x159d220)
    /Users/andyw8/src/github.com/Shopify/themekit/src/cmdutil/util.go:288 +0x2e
golang.org/x/sync/errgroup.(*Group).Go.func1(0xc0001c0c00, 0xc000210220)
    /Users/andyw8/go/pkg/mod/golang.org/x/sync@v0.0.0-20190911185100-cd5d95a43a6e/errgroup/errgroup.go:57 +0x57
created by golang.org/x/sync/errgroup.(*Group).Go
    /Users/andyw8/go/pkg/mod/golang.org/x/sync@v0.0.0-20190911185100-cd5d95a43a6e/errgroup/errgroup.go:54 +0x66
andyw8 commented 4 years ago

This should be solved by #809.

andyw8 commented 4 years ago

@pcook2 We've fixed the issue and will have a new release of Theme Kit out very soon.

andyw8 commented 4 years ago

@pcook2 You can now run theme update to update to v1.1.2. Please re-open the issue if you are still having problems.

pcook2 commented 4 years ago

Thanks @andyw8. I will keep watching how it works.

pcook2 commented 4 years ago

By the way, may I have a question? Sometimes, when I run theme download to force to download current live theme to my local files, the progress bar shows only 10~20 files updating. Does it make sure all files from live theme are replacing my old files in local directory?

andyw8 commented 4 years ago

@pcook2 We use checksums to compare the local and remote files, so only changed files are downloaded. If you run theme download --verbose you'll see more information.

pcook2 commented 4 years ago

Thank you @andyw8