[ 
https://issues.apache.org/jira/browse/TINKERPOP-2767?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Simon Zhao updated TINKERPOP-2767:
----------------------------------
    Description: 
Originally encountered when fixing 
[TINKERPOP-2754|[[https://issues.apache.org/jira/projects/TINKERPOP/issues/TINKERPOP-2754?filter=allopenissues].|https://issues.apache.org/jira/projects/TINKERPOP/issues/TINKERPOP-2754?filter=allopenissues]

 

The following traversal in JS seems to cause hanging the first time you run it 
on a newly launched gremlin-server (3.5.3) via docker

 
{{await g.V('1').repeat(_.out()).times(1500).next();}}
 
The same hanging occurs in gremlin-go. 
 
{{{}{_}, err = g.With("evaluationTimeout", 
1000).V("1").Repeat(gremlingo.T{_}_.Out()).Times(int32(1500)).Next(){}}}{{{{}}{}}}

 

The timeout is optional, but indicates that something is going wrong since it 
is not returning. Interestingly enough, if the timeout is very low, then it 
won't hang because it will say the timeout was exceeded. This indicates that if 
the traversal is completed within the timeout, it's just not returning for some 
reason on the first call.

 

If you were to write a script and invoke this snippet of code, it will hang. If 
you forcefully terminate the script and rerun it, then it doesn't hang.

 

main.go
{code:java}
package main

import (
   gremlingo "github.com/apache/tinkerpop/gremlin-go/v3/driver"
   "log"
)

func main() {
   driver, err := 
gremlingo.NewDriverRemoteConnection("ws://localhost:45940/gremlin")
   if err != nil {
      log.Print("Err creating DRC")
      return
   }
   defer driver.Close()

   log.Println("Start")
   g := gremlingo.Traversal_().WithRemote(driver)
   LABEL := "test"
   _, err = g.V().HasLabel(LABEL).Drop().Next()
   _, err = g.AddV(LABEL).Property(gremlingo.T.Id, "1").Next()
   _, err = g.AddV(LABEL).Property(gremlingo.T.Id, "2").Next()
   _, err = 
g.AddE(LABEL).From(gremlingo.T__.V("1")).To(gremlingo.T__.V("2")).Property(gremlingo.T.Id,
 "e1").Next()
   _, err = 
g.AddE(LABEL).From(gremlingo.T__.V("2")).To(gremlingo.T__.V("1")).Property(gremlingo.T.Id,
 "e2").Next()
   if err != nil {
      log.Println("Error during setup")
      return
   }
   log.Println("Start the problematic traversal")
   _, err = g.With("evaluationTimeout", 
1000).V("1").Repeat(gremlingo.T__.Out()).Times(int32(1500)).Next()
   if err != nil {
      log.Println("Error with the problematic traversal, but we didn't hang")
      return
   }
   log.Println("End")
} {code}

  was:
Originally encountered when fixing 
[TINKERPOP-2754|[https://issues.apache.org/jira/projects/TINKERPOP/issues/TINKERPOP-2754?filter=allopenissues].]

 

The following traversal in JS seems to cause hanging the first time you run it 
on a newly launched gremlin-server (3.5.3) via docker

 
{{await g.V('1').repeat(_.out()).times(1500).next();}}
 
The same hanging occurs in gremlin-go. 
 
{{{}_, err = g.With("evaluationTimeout", 
1000).V("1").Repeat(gremlingo.T__.Out()).Times(int32(1500)).Next(){}}}{{{}{}}}

 

The timeout is optional, but indicates that something is going wrong since it 
is not returning. Interestingly enough, if the timeout is very low, then it 
won't hang because it will say the timeout was exceeded. This indicates that if 
the traversal is completed within the timeout, it's just not returning for some 
reason on the first call.

 

If you were to write a script and invoke this snippet of code, it will hang. If 
you forcefully terminate the script and rerun it, then it doesn't hang.

 

main.go
{code:java}
package main

import (
   gremlingo "github.com/apache/tinkerpop/gremlin-go/v3/driver"
   "log"
)

func main() {
   driver, err := 
gremlingo.NewDriverRemoteConnection("ws://localhost:45940/gremlin")
   if err != nil {
      log.Print("Err creating DRC")
      return
   }
   defer driver.Close()

   log.Println("Start")
   g := gremlingo.Traversal_().WithRemote(driver)
   LABEL := "test"
   _, err = g.V().HasLabel(LABEL).Drop().Next()
   _, err = g.AddV(LABEL).Property(gremlingo.T.Id, "1").Next()
   _, err = g.AddV(LABEL).Property(gremlingo.T.Id, "2").Next()
   _, err = 
g.AddE(LABEL).From(gremlingo.T__.V("1")).To(gremlingo.T__.V("2")).Property(gremlingo.T.Id,
 "e1").Next()
   _, err = 
g.AddE(LABEL).From(gremlingo.T__.V("2")).To(gremlingo.T__.V("1")).Property(gremlingo.T.Id,
 "e2").Next()
   if err != nil {
      log.Println("Error during setup")
      return
   }
   log.Println("Start the problematic traversal")
   _, err = g.With("evaluationTimeout", 
1000).V("1").Repeat(gremlingo.T__.Out()).Times(int32(1500)).Next()
   if err != nil {
      log.Println("Error with the problematic traversal, but we didn't hang")
      return
   }
   log.Println("End")
} {code}


> Repeat Out Times traversal hangs indefinitely on first execution
> ----------------------------------------------------------------
>
>                 Key: TINKERPOP-2767
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2767
>             Project: TinkerPop
>          Issue Type: Bug
>    Affects Versions: 3.5.3
>         Environment: Windows 10
>            Reporter: Simon Zhao
>            Priority: Major
>
> Originally encountered when fixing 
> [TINKERPOP-2754|[[https://issues.apache.org/jira/projects/TINKERPOP/issues/TINKERPOP-2754?filter=allopenissues].|https://issues.apache.org/jira/projects/TINKERPOP/issues/TINKERPOP-2754?filter=allopenissues]
>  
> The following traversal in JS seems to cause hanging the first time you run 
> it on a newly launched gremlin-server (3.5.3) via docker
>  
> {{await g.V('1').repeat(_.out()).times(1500).next();}}
>  
> The same hanging occurs in gremlin-go. 
>  
> {{{}{_}, err = g.With("evaluationTimeout", 
> 1000).V("1").Repeat(gremlingo.T{_}_.Out()).Times(int32(1500)).Next(){}}}{{{{}}{}}}
>  
> The timeout is optional, but indicates that something is going wrong since it 
> is not returning. Interestingly enough, if the timeout is very low, then it 
> won't hang because it will say the timeout was exceeded. This indicates that 
> if the traversal is completed within the timeout, it's just not returning for 
> some reason on the first call.
>  
> If you were to write a script and invoke this snippet of code, it will hang. 
> If you forcefully terminate the script and rerun it, then it doesn't hang.
>  
> main.go
> {code:java}
> package main
> import (
>    gremlingo "github.com/apache/tinkerpop/gremlin-go/v3/driver"
>    "log"
> )
> func main() {
>    driver, err := 
> gremlingo.NewDriverRemoteConnection("ws://localhost:45940/gremlin")
>    if err != nil {
>       log.Print("Err creating DRC")
>       return
>    }
>    defer driver.Close()
>    log.Println("Start")
>    g := gremlingo.Traversal_().WithRemote(driver)
>    LABEL := "test"
>    _, err = g.V().HasLabel(LABEL).Drop().Next()
>    _, err = g.AddV(LABEL).Property(gremlingo.T.Id, "1").Next()
>    _, err = g.AddV(LABEL).Property(gremlingo.T.Id, "2").Next()
>    _, err = 
> g.AddE(LABEL).From(gremlingo.T__.V("1")).To(gremlingo.T__.V("2")).Property(gremlingo.T.Id,
>  "e1").Next()
>    _, err = 
> g.AddE(LABEL).From(gremlingo.T__.V("2")).To(gremlingo.T__.V("1")).Property(gremlingo.T.Id,
>  "e2").Next()
>    if err != nil {
>       log.Println("Error during setup")
>       return
>    }
>    log.Println("Start the problematic traversal")
>    _, err = g.With("evaluationTimeout", 
> 1000).V("1").Repeat(gremlingo.T__.Out()).Times(int32(1500)).Next()
>    if err != nil {
>       log.Println("Error with the problematic traversal, but we didn't hang")
>       return
>    }
>    log.Println("End")
> } {code}



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to