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

Random seg fault while checking medium sized repo through docker #246

Open
marty30 opened this issue Jan 19, 2023 · 7 comments
Open

Random seg fault while checking medium sized repo through docker #246

marty30 opened this issue Jan 19, 2023 · 7 comments

Comments

@marty30
Copy link

marty30 commented Jan 19, 2023

Run command: docker run --rm --volume=/var/lib/jenkins/workspace/path/to/repository:/check mstruebing/editorconfig-checker ec

.ecrc file (slightly redacted)

{
  "Version": "2.4.0",
  "Verbose": true,
  "Debug": false,
  "IgnoreDefaults": false,
  "Exclude": [
    ".*/target/.*",
    "target/.*",
    "schema.json$",
    "\\.idea/.*",
    "\\.editorconfig$",
    "dependencies_.*\\.txt",
    "docker/.*"
  ],
  "Disable": {
      "EndOfLine": false,
      "Indentation": false,
      "IndentSize": false,
      "InsertFinalNewline": false,
      "TrimTrailingWhitespace": false,
      "MaxLineLength": true
    }
}

Sometimes it fails on our Jenkins node running docker. The host is a RHEL7 machine.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x5a33b2]
goroutine 1 [running]:
github.com/editorconfig-checker/editorconfig-checker/pkg/files.GetFiles.func2(0xc000323b70, 0xd, 0x0, 0x0, 0x63baa0, 0xc0000a19e0, 0x0, 0x0)
	/ec/pkg/files/files.go:103 +0x52
path/filepath.walk(0xc0000b6c60, 0x6, 0x63e348, 0xc00011e4e0, 0xc0004cfcc0, 0x0, 0xc0000c6420)
	/usr/local/go/src/path/filepath/path.go:434 +0x226
path/filepath.Walk(0xc0000b6c60, 0x6, 0xc000115cc0, 0x0, 0x63bce0)
	/usr/local/go/src/path/filepath/path.go:501 +0x113
github.com/editorconfig-checker/editorconfig-checker/pkg/files.GetFiles(0x0, 0x5fb4bf, 0x5, 0xc0000b6a90, 0x5, 0x1, 0xc0000a3d40, 0xd, 0xd, 0x7438e0, ...)
	/ec/pkg/files/files.go:102 +0x5e5
main.main()
	/ec/cmd/editorconfig-checker/main.go:107 +0x318

Any suggestions?

@mstruebing
Copy link
Member

What do you mean by sometimes? What's the difference when it fails and when not?

@marty30
Copy link
Author

marty30 commented Jan 19, 2023

I have not yet noticed any difference. Still trying to figure that one out. I believe that re-running the same pipeline (so the same code) can pass the first time and fail the next, or the other way around.

@mstruebing
Copy link
Member

Would be great if you could confirm this, and if this is the case.
Additionally, if that is the case it would be great if you could provide some steps to reproduce it, even if it only happens occasionally.

@marty30
Copy link
Author

marty30 commented Jan 20, 2023

I have done some more research. Could it have to do with one process writing to a file while the editorconfig-checker is running? The panic seems to occur on Don't add /check/target/checkstyle-cachefile to be checked and we run checkstyle with maven at the same time.

@mstruebing
Copy link
Member

Could be some kind of race condition if editorconfig-checker tries to read the file while it's not present anymore I think.

@marty30
Copy link
Author

marty30 commented Jan 23, 2023

I now have proof that it without making any changes to the code, the exact same command fails first, and passes after. For now I added a retry mechanism to solve the issue for me. There are multiple processes that are running at the same time however (building the maven project, running checkstyle and running editorconfig-checker). So a race condition might very well be possible. Please let me know if you are able to resolve this issue or what specific information I can provide to help out. I have no Go experience, so it is hard to do any static analysis.

@mstruebing
Copy link
Member

It would be very great to make this reproducible somehow locally.
If anyone is willing to provide a PR which can simulate that failure I can have a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants