Skip to content

errNoAvailableYet wait mechanism doesn't work(got panic) #33

@Allyin

Description

@Allyin

Hello.

In my knowledge, errNoAvailableYet occur when the the time of the current package is large than (T-59m).

This will definitely happen because the seed generation time is 1 minute, but the polling time is 20s.
image

When the time occurs, code should wait for the seed to be generated, but the program will panic directly.

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

goroutine 117 [running]:
github.com/VirusTotal/vt-go.(*Feed).getObjects(0xc000410e00, 0xc013b3ce70, 0xc, 0x0, 0x0, 0x0, 0x0, 0x0)
        /root/go/pkg/mod/github.com/!virus!total/vt-go@v0.0.0-20230116080936-b3d5f29df3c3/feed.go:189 +0x684
github.com/VirusTotal/vt-go.(*Feed).retrieve(0xc000410e00)
        /root/go/pkg/mod/github.com/!virus!total/vt-go@v0.0.0-20230116080936-b3d5f29df3c3/feed.go:227 +0xaa
created by github.com/VirusTotal/vt-go.(*Client).NewFeed
        /root/go/pkg/mod/github.com/!virus!total/vt-go@v0.0.0-20230116080936-b3d5f29df3c3/feed.go:126 +0x22a

I analyzed this problem, bug arises from the error return of parseResponse.
image

This 400 resp'Content-Type is application/json,but the error used gzip, and then returned a nil Response.
image

image

use any time of the current package which large than (T-59m) can reproduce this problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions