Skip to content

Ensure Critical Errors are logged Before Termination #921

@pleshakov

Description

@pleshakov

Currently, when the code panics, we get the following in the logs:

panic: unknown file type 1
goroutine 220 [running]:
github.com/nginxinc/nginx-kubernetes-gateway/internal/mode/static/nginx/file.ensureType(...)
        github.com/nginxinc/nginx-kubernetes-gateway/internal/mode/static/nginx/file/manager.go:148
github.com/nginxinc/nginx-kubernetes-gateway/internal/mode/static/nginx/file.writeFile({0x1bba038?, 0x27cac98?}, {{0xc00049e080, 0x3a}, {0xc0003b8800, 0xa8e, 0xa8e}, 0x1})
        github.com/nginxinc/nginx-kubernetes-gateway/internal/mode/static/nginx/file/manager.go:116 +0x4d9
github.com/nginxinc/nginx-kubernetes-gateway/internal/mode/static/nginx/file.(*ManagerImpl).ReplaceFiles(0xc0002d01c0, {0xc0004c33e0, 0x2, 0x1?})
        github.com/nginxinc/nginx-kubernetes-gateway/internal/mode/static/nginx/file/manager.go:104 +0x32d
github.com/nginxinc/nginx-kubernetes-gateway/internal/mode/static.(*eventHandlerImpl).updateNginx(0xc000174800, {0x1bb9348, 0xc00026b900}, {0xc00048b6e0, {0xc00046e580, 0x1, 0x1}, {0xc0004a4000, 0x2, 0x2}, ...})
        github.com/nginxinc/nginx-kubernetes-gateway/internal/mode/static/handler.go:85 +0x9e
github.com/nginxinc/nginx-kubernetes-gateway/internal/mode/static.(*eventHandlerImpl).HandleEventBatch(0xc000174800, {0x1bb9348, 0xc00026b900}, {0xc00047e500?, 0x14, 0xc00012f720?})
        github.com/nginxinc/nginx-kubernetes-gateway/internal/mode/static/handler.go:71 +0x210
github.com/nginxinc/nginx-kubernetes-gateway/internal/framework/events.(*EventLoop).Start.func1.1({0xc00047e500, 0x14, 0x14})
        github.com/nginxinc/nginx-kubernetes-gateway/internal/framework/events/loop.go:68 +0x10a
created by github.com/nginxinc/nginx-kubernetes-gateway/internal/framework/events.(*EventLoop).Start.func1
        github.com/nginxinc/nginx-kubernetes-gateway/internal/framework/events/loop.go:65 +0x14a

Acceptance criteria:

  • Log an error before exiting so that it can be parsed by the logging systems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogCurrently unprioritized work. May change with user feedback or as the product progresses.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions