unclebob / fitnesse

FitNesse -- The Acceptance Test Wiki
fitnesse.org
Other
2.03k stars 712 forks source link

java.net.SocketException: Broken pipe (Write failed) when on remote-linux/openshift #1283

Open stefanfoxfiducia opened 4 years ago

stefanfoxfiducia commented 4 years ago

Hi there, we're using Fitnesse v20200404 on an openshift-system under jre-8u251-linux-x64.rpm. More, in our fixture-code we've implemented selenium calls (org.openqa.selenium) für automatically testing our slim-test-suites (all with script-tables).

When runnning tests under local windows10-Systems everything works fine. Running tests in openshift we almost everytime get the exceptions which I've put to the end of this issue. We've raised the memory für fitnesse and slim, played around with timeouts but nothing did work.

Maybe you've got some tips for us? Thanx in advance, Stefan

look at the log: error_broken_pipe.txt

fhoeben commented 4 years ago

I assume your running your tests via a FitNesse (wiki) server, but starting them from a browser (so not from the command line or via jUnit runner). Is this correct?

I get a similar error in my console on my Mac when running the wiki locally and deep linking directly to a test page (i.e. open a url with &test or &suite at the end). The test actually runs fine, but the error in the console where I started the wiki is annoying.

Do the tests run ok in your situation, or are they actually stopping because of this error?

I believe the cause of the error is that the browser is doing an extra request to the url, but it doesn't wait to receive the full response but aborts its request. This extra request is done in parallel to the original request. The original request (which is shown in the browser) runs as normal.

stefanfoxfiducia commented 4 years ago

Hi, to answer your questions: at the Moment, we're starting our tests by just clicking on the "test" or "suit" - button in the Browser. Fitnesse-Server is running in a remote openshift-docker-image.

the tests do NOT run fine, they will hang indefinetly, but in the server-log on our openshift-server I find the exception i mentioned in my first post.

In the long run we plan to start the tests over jenkins-pipelines by using the fitnesse-jenkins plugin. When doing this now at the moment we get similiar exceptions which I have attached as a txt-file.

fitnesse_plugin.txt

stefanfoxfiducia commented 4 years ago

accidently closed this issue, problems remain like described

fhoeben commented 4 years ago

Thanks for the additional information. That is indeed another problem then the one I encounter on my Mac, and much worse.

With regards to running your tests on Jenkins: may I suggest you look at running your tests via the jUnit runner? This removes the need for an extra plugin on the build server, always works with the latest version of FitNesse, also makes it easy to debug your tests from an IDE and allows you to run your tests in parallel (if your fixtures, SUT/test setup support it). It will give you results in surefire XML format (which Jenkins supports out-of-the-box) and HTML reports (which, if I recall correctly, could be published using a generic HTML publishing plugin).

I believe the Jenkins FitNesse plugin can be used, but haven't done so myself, but I have seen some problems/questions on stackoverflow which remained unanswered. Just my 2cts.

reators commented 4 years ago

Hi, I'm observing the same error, but only while using the combination of

Jenkins-FitNesse-Plugin

Calling a single test from plugin works fine, as long as the test passes. If the test fails: same error and no fitnesse-result.xml being written which sadly prevents analyzing the failure.

stefanfoxfiducia commented 4 years ago

@fhoeben: To answer Your last comment: running our tests as junit-tests is no option for us due to our companie's regulations. More than that, our testing staff should't need to know about junit-in-source-code and we prefer using an out-of-the-box system to just fit in our test environment. So maybe there's another solution...

tcnh commented 4 years ago

Seems to be related with https://github.com/unclebob/fitnesse/issues/1187 I did a stab at fixing it back then, but failed miserably in finding a solution that works in all os/browsers because of the differences in how browsers handle closing CR/LF characters.

@stefanfoxfiducia what browser(s) did you try? Earlier, this seemed to occur mostly in Firefox but not in Chrome.

@reators I think if you're already using hsac-fitnesse-fixtures, using the hsac junit runner might prove a valuable alternative to the jenkins plugin

fhoeben commented 4 years ago

@stefanfoxfiducia running with the jUnit runner does not have to mean you expose your testing staff to jUnit. You can just write one generic jUnit Java test (which runs your specific suite, or is configurable via property from Jenkins) and have that executed by Jenkins (via Maven, Gradle or Ant, or...). The jUnit test just acts as a launcher for a local FitNesse Java proces, and saves results in HTML and surefire XML format. I included such a generic jUnit class in my hsac fixture sample project, and use a similar one in docker containers to run tests. To run test you just have to name the suite.

reators commented 4 years ago

@fhoeben , @tcnh: Thanks for your suggestions. I observed that tests that need more than 35s to execute always fail with said "Broken pipe" error. This correlates with the default timeout of 30s for routes in OpenShift (tests that run on a local FitNesse installation don't have this problem). @stefanfoxfiducia gave me a crucial hint to solve this:

The solution in this case is to add in OpenShift for FitNesse-POD these lines to template.yaml file which increase the routing-timeout (I added them also to Selenium-Hub's template.yaml which may be not needed).

Actually only the three lines after name were added to an existing entry. The rest is only to provide some context:

  - apiVersion: v1
    kind: Route
    metadata:
      labels:
        app: ${{APP}}
      name: ${{APP}}
      annotations:
        haproxy.router.openshift.io/timeout: 1h
        team: ${{NAMESPACE}}