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

'panic: runtime error: slice bounds out of range' during test run #1073

Closed
dengayevskiy opened this issue Jun 4, 2018 · 6 comments
Closed
Labels

Comments

@dengayevskiy
Copy link

dengayevskiy commented Jun 4, 2018

Hi! We have an issue that reproduces time to time on our CI agents (Ubuntu 14.04.4 LTS; JRE: 1.8.0_91-b14). Tests are run in 8 threads using gauge:execute -DinParallel=true -Dnodes=8

Here is a stacktrace:

[10:40:11][com.tests] panic: runtime error: slice bounds out of range
[10:40:11][com.tests] 
[10:40:11][com.tests] goroutine 2816 [running]:
[10:40:11][com.tests] github.com/getgauge/gauge/conn.readResponse(0xc61e20, 0xc4201fc0f8, 0xc420c258c0, 0x17e, 0x240, 0x0, 0x0)
[10:40:11][com.tests]     src/github.com/getgauge/gauge/conn/network.go:99 +0x215
[10:40:11][com.tests] github.com/getgauge/gauge/conn.writeDataAndGetResponse(0xc61e20, 0xc4201fc0f8, 0xc420c258c0, 0x17e, 0x240, 0x0, 0x0, 0x0, 0x0, 0x0)
[10:40:11][com.tests]     src/github.com/getgauge/gauge/conn/network.go:83 +0xb6
[10:40:11][com.tests] github.com/getgauge/gauge/conn.getResponseForGaugeMessage(0xc420daca50, 0xc61e20, 0xc4201fc0f8, 0xc4202192c0, 0xc420219320, 0x0, 0x0)
[10:40:11][com.tests]     src/github.com/getgauge/gauge/conn/network.go:137 +0x1e6
[10:40:11][com.tests] created by github.com/getgauge/gauge/conn.GetResponseForMessageWithTimeout
[10:40:11][com.tests]  src/github.com/getgauge/gauge/conn/network.go:163 +0xd9

Gauge version: 0.9.9

Plugins
html-report (4.0.4)
java (0.6.7)
screenshot (0.0.1)
spectacle (0.1.2)
xml-report (0.2.0)

@zabil
Copy link
Member

zabil commented Jun 6, 2018

Related to #134

@zabil zabil added the community label Jun 8, 2018
@nehashri nehashri added bug and removed community labels Jul 2, 2018
@olejkavn
Copy link
Contributor

olejkavn commented Jul 18, 2018

[18:16:27][Step 6/10] Message length is 8191
[18:16:27][Step 6/10] 
[18:16:27][Step 6/10] Buffer length is 8192
[18:16:27][Step 6/10] 
[18:16:27][Step 6/10] Bytes read: 2
[18:16:27][Step 6/10] 
[18:16:27][Step 6/10] Message length + bytes read = 8193
[18:16:27][Step 6/10] 
[18:16:27][Step 6/10] Failed to execute goal com.thoughtworks.gauge.maven:gauge-maven-plugin:1.3.3:execute (default-cli) on project amazing-tests: Gauge Specs execution failed. null
[18:16:27][Step 6/10] ##teamcity[projectFinished tc:tags='tc:internal' projectId='com.mycompany.services.amazing-tests:jar:1.0-SNAPSHOT']
[18:16:27][Step 6/10] [INFO] ------------------------------------------------------------------------
[18:16:27][Step 6/10] [INFO] BUILD FAILURE
[18:16:27][Step 6/10] [INFO] ------------------------------------------------------------------------
[18:16:27][Step 6/10] [INFO] Total time: 03:42 min
[18:16:27][Step 6/10] [INFO] Finished at: 2018-07-17T16:16:27+01:00
[18:16:27][Step 6/10] panic: runtime error: slice bounds out of range
[18:16:27][Step 6/10] 
[18:16:27][Step 6/10] goroutine 1851 [running]:
[18:16:27][Step 6/10] github.com/getgauge/gauge/conn.readResponse(0xb0f320, 0xc4201d40e8, 0xc421434a00, 0x13f, 0x200, 0x0, 0x0)
[18:16:27][Step 6/10]     C:/projects/go/src/github.com/getgauge/gauge/conn/network.go:105 +0x68c
[18:16:27][Step 6/10] github.com/getgauge/gauge/conn.writeDataAndGetResponse(0xb0f320, 0xc4201d40e8, 0xc421434a00, 0x13f, 0x200, 0x0, 0x0, 0x0, 0x0, 0x0)
[18:16:27][Step 6/10]     C:/projects/go/src/github.com/getgauge/gauge/conn/network.go:84 +0xa9
[18:16:27][Step 6/10] github.com/getgauge/gauge/conn.getResponseForGaugeMessage(0xc421535d40, 0xb0f320, 0xc4201d40e8, 0xc420abc480, 0xc420abc4e0, 0x0, 0x0)
[18:16:27][Step 6/10]     C:/projects/go/src/github.com/getgauge/gauge/conn/network.go:143 +0x1ca
[18:16:27][Step 6/10] created by github.com/getgauge/gauge/conn.GetResponseForMessageWithTimeout
[18:16:27][Step 6/10]     C:/projects/go/src/github.com/getgauge/gauge/conn/network.go:170 +0xd9
func readResponse(conn net.Conn) ([]byte, error) {
    buffer := new(bytes.Buffer)
    data := make([]byte, 8192)
    for {
        n, err := conn.Read(data)
        if err != nil {
            conn.Close()
            return nil, fmt.Errorf("Connection closed [%s] cause: %s", conn.RemoteAddr(), err.Error())
        }

        buffer.Write(data[0:n])
        messageLength, bytesRead := proto.DecodeVarint(buffer.Bytes())
        if messageLength > 0 && messageLength < uint64(buffer.Len()) {
            logger.Infof(true, "Message length is %d\n", messageLength)
            logger.Infof(true, "Buffer length is %d\n", buffer.Len())
            logger.Infof(true, "Bytes read: %d\n", bytesRead)
            logger.Infof(true, "Message length + bytes read = %d\n", messageLength+uint64(bytesRead))

            return buffer.Bytes()[bytesRead : messageLength+uint64(bytesRead)], nil
        }
    }
}

but in my logs I see bigger numbers, like:

[18:16:22][Step 6/10] Message length is 11687
[18:16:22][Step 6/10] 
[18:16:22][Step 6/10] Buffer length is 11689
[18:16:22][Step 6/10] 
[18:16:22][Step 6/10] Bytes read: 2
[18:16:22][Step 6/10] 
[18:16:22][Step 6/10] Message length + bytes read = 11689

@olejkavn
Copy link
Contributor

@olejkavn
Copy link
Contributor

#1117
please check this is fix

@zabil zabil added the ready label Jul 31, 2018
@sriv
Copy link
Member

sriv commented Aug 2, 2018

This was addressed as part of #1117

@sswaroopgupta
Copy link
Contributor

Verified with

Gauge version: 1.0.1.nightly-2018-08-01
Commit Hash: 6aa1ce2

Plugins
-------
java (0.6.9.nightly-2018-07-27)

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

No branches or pull requests

6 participants