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

Greenmask V0.1.13 SIGSEGV #102

Closed
TCY16 opened this issue May 7, 2024 · 6 comments · Fixed by #103
Closed

Greenmask V0.1.13 SIGSEGV #102

TCY16 opened this issue May 7, 2024 · 6 comments · Fixed by #103
Assignees
Labels
bug Something isn't working

Comments

@TCY16
Copy link

TCY16 commented May 7, 2024

Hi!

While using Greenmask for the first time, I've encountered a segfault. Using the dump option while testing on a single table in my database. I've verified connection with psql following config:

dump:
  pg_dump_options:
    dbname: "host=obfuscated-amazon-address user=postgres dbname=db_name"
    jobs: 10
    table: "tablename"
storage:
  type: "directory"
  directory:
    path: "/home/ssm-user/tmp"

The segfault output is:

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

goroutine 151 [running]:
github.com/jackc/pgx/v5.(*LargeObject).Close(...)
	/home/runner/go/pkg/mod/github.com/jackc/pgx/[email protected]/large_objects.go:156
github.com/greenmaskio/greenmask/internal/db/postgres/dumpers.(*BlobsDumper).Execute.func2.2()
	/home/runner/work/greenmask/greenmask/internal/db/postgres/dumpers/large_object.go:95 +0x31
github.com/greenmaskio/greenmask/internal/db/postgres/dumpers.(*BlobsDumper).Execute.func2()
	/home/runner/work/greenmask/greenmask/internal/db/postgres/dumpers/large_object.go:100 +0x1f1
golang.org/x/sync/errgroup.(*Group).Go.func1()
	/home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:78 +0x56
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 65
	/home/runner/go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:75 +0x96

For completeness; The uname -r output gives: 6.1.79-99.167.amzn2023.x86_64. I've used greenmask-linux-amd64.tar.gz and the following libraries postgresql15 postgresql15-contrib. The database version is Postgres 15 as well.

On a different note, I've also found that greenmask dump --data-only gives a schema collision error : "pg_dump: error: options -s/--schema-only and -a/--data-only cannot be used together"

@wwoytenko
Copy link
Contributor

Hi! Thank you for reporting!

github.com/greenmaskio/greenmask/internal/db/postgres/dumpers.(*BlobsDumper).Execute.func2.2()

Looks like the seg fault is in Large Object dumping. I will check this tomorrow. There is definitely a bug.

On a different note, I've also found that greenmask dump --data-only gives a schema collision error : "pg_dump: error: options -s/--schema-only and -a/--data-only cannot be used together"

Well, you're right. I will review this case tomorrow as well.

@wwoytenko
Copy link
Contributor

I've created #103 PR, but I will review the logic. I think there might be high resource utilization without a worker pool pattern. I will keep you posted

@wwoytenko
Copy link
Contributor

wwoytenko commented May 8, 2024

@TCY16

The large object dumper seg fault I hope will be fixed in #103

The fix is expected to be published as v0.1.14 on Thursday (09.05.2024)

Regarding this

On a different note, I've also found that greenmask dump --data-only gives a schema collision error : "pg_dump: error: options -s/--schema-only and -a/--data-only cannot be used together"

I've opened issue #104 and initialized a PR #105

@wwoytenko
Copy link
Contributor

Regarding --data-only workaround right now

I recommend creating dump as usual without --data-only.

But if you need to restore only data you can call restore --data-only.

@TCY16
Copy link
Author

TCY16 commented May 8, 2024

Thanks for the super quick turnaround! I'll post more issues if they come up 😄

@wwoytenko
Copy link
Contributor

Published in 0.1.14. Let me know if everything is ok

@wwoytenko wwoytenko moved this from In progress to Done in Engineering May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants