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

Error logging #250

Open
Lewiscowles1986 opened this issue May 25, 2022 · 0 comments
Open

Error logging #250

Lewiscowles1986 opened this issue May 25, 2022 · 0 comments

Comments

@Lewiscowles1986
Copy link
Collaborator

Lewiscowles1986 commented May 25, 2022

This issue is in response to this slack thread

The error is about a sub-process call exiting with a non-zero error code.
Interestingly, re-running can lead to this error going away.
While I cannot reproduce the specific file and test failure locally, there are others, and this reproduces across PHP versions.

What I think is happening is that parallel runs binding to the same port may be causing some sub-process calls that bind a port to crash, but there are other race-condition issues, such as:

  • incomplete STDOUT output

  • some long-lived PR's calling a changing file-system structure

    src/PhpPact/Standalone/Installer/../../../../pact/pact-stub-server.exe --file=tests/PhpPact/Standalone/StubService/Service/../../../../_resources/someconsumer-someprovider.json --port=7201
    

    should be the much simpler

    pact/bin/pact-stub-service.bat tests/_resources/someconsumer-someprovider.json --port=7201
    

Ideal interim fixes

  • use abspath to cut out the back and forth. src/PhpPact/Standalone/Installer/../../../../pact is just pact

  • use redirection pipes to have the operating system capture logs for each job, so you don't need PHP to.

    pact/bin/pact-stub-service.bat tests/_resources/someconsumer-someprovider.json --port=7201 2> error-log-path 1> output-log-path
    
    • this makes it easier to then within parallel processes address logs after a process is finished.
    • this does need a non-colliding path, which could pollute / complicate the runner
    • in CI, this would save an artifact most computer literate users could see the error messages for the specific process
    • for local / dev / consumer this would need to be documented (what is missing from my above description?)
  • More debug logs.

    • I'd love a trace mode to see which url a file is being downloaded from. When that is run, what HTTP calls are being made. What sub-process calls (above notes on paths 🙏 ), so that, I feel less lost.
  • treat the file-system paths like an API contract. It does not change, without good reason.

  • treat arguments like an API contract. They do not change without good reason, and maybe a local doc, or output pointing to the recent changes in output if they do change.

  • new one when running the phpunit suite multiple times, sometimes for whatever reason the child process for pact-stub-service would remain running, blocking port 7201, causing test to hang until composer timeout. lsof -i :7201 can detect this. Currently unsure how to check this. This survives the parent process, and I'm not sure is isolated to this particular process; it's just the only one I've seen.

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

No branches or pull requests

1 participant