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

Read Time Out on command in production #8969

Closed
StevenHeven opened this issue Jul 29, 2019 · 18 comments
Closed

Read Time Out on command in production #8969

StevenHeven opened this issue Jul 29, 2019 · 18 comments
Assignees
Labels

Comments

@StevenHeven
Copy link

StevenHeven commented Jul 29, 2019

OrientDB Version: 3.0.18

Java Version: 8

OS: Linux (Debian) [PROD]

I add trouble on production. This works well on localhost.

Expected behavior

I want to have all my datas (Vertex and Edges) to create a graph in my front (React) with command batch like that :

BEGIN; 
 LET list0 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#34:20; 
 LET list1 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#25:1735; 
 LET list2 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#26:1732; 
 LET list3 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#25:1736; 
 LET list4 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#24:492; 
 LET list5 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#25:1745; 
 LET list6 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#24:488; 
 LET list7 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#25:1750; 
 LET list8 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#26:1741; 
 LET list9 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#25:1738; 
 LET list10 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#26:1734; 
 LET list11 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#26:1733; 
 LET list12 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#25:1737; 
 LET list13 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#25:1740; 
 LET list14 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#24:494; 
 LET list15 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#24:490; 
 LET list16 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#24:489; 
 LET list17 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#25:1749; 
 LET list18 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#26:1736; 
 LET list19 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#26:1735; 
 LET list20 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#25:1739; 
 LET list21 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#25:1741; 
 LET list22 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#26:1737; 
 LET list23 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#26:1738; 
 LET list24 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#24:491; 
 LET list25 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#26:1745; 
 LET list26 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#25:1753; 
 LET list27 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#25:1742; 
 LET list28 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#26:1739; 
 LET list29 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#23:486; 
 LET list30 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#26:1769; 
 LET list31 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#25:1772; 
 LET list32 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#25:1744; 
 LET list33 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#24:493; 
 LET list34 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#26:1740; 
 LET list35 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#26:1742; 
 LET list36 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#25:1746; 
 LET list37 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#26:1743; 
 LET list38 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#26:1746; 
 LET list39 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#25:1748; 
 LET list40 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#26:1744; 
 LET list41 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#25:1747; 
 LET list42 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#26:1747; 
 LET list43 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#25:1751; 
 LET list44 = SELECT EXPAND(out("ProjectEdge")) from OrientVertex where @rid=#25:1773; 
COMMIT RETRY 45;
RETURN [$list0, $list1, $list2, $list3, $list4, $list5, $list6, $list7, $list8, $list9, $list10, $list11, $list12, $list13, $list14, $list15, $list16, $list17, $list18, $list19, $list20, $list21, $list22, 4, $list25, $list26, $list27, $list28, $list29, $list30, $list31, $list32, $list33, $list34, $list35, $list36, $list37, $list38, $list39, $list40, $list41, $list42, $list43, $list44]

I made this command execution by JAVA like that :

public List<OElement> getNeighbourByNode(List<ProjectVertex> allVertex){

		StringBuilder startGetListVertexCommand = new StringBuilder("BEGIN;");
		StringBuilder returnGetListVertexCommand = new StringBuilder("RETURN [");

		int count;
		// Iterate on every vertex to build command line
		for (count=0; count < allVertex.size(); count++) {
			startGetListVertexCommand.append(" LET list").append(count).append(" = SELECT EXPAND(")
				.append(EdgeDirectionDesired.CHILD.getQuery())
				.append("(\"")
				.append(ProjectEdge.class.getSimpleName())
				.append("\")) from ")
				.append(OrientVertex.class.getSimpleName())
				.append(" where @rid=")
				.append(allVertex.get(count).getId())
				.append("; \n");
			returnGetListVertexCommand.append("$list").append(count);
			if (count != allVertex.size() - 1) {
				returnGetListVertexCommand.append(", ");
			}
		}

		startGetListVertexCommand.append(returnGetListVertexCommand).append("]");

		// Execute command and get the result
		return orientDBManager.executeCommand(startGetListVertexCommand.toString());
	}

And in my orientDB Manager, it's look like :

public List<OElement> executeCommand(String command, Object... args) {
		LOGGER.debug("COMMAND : " + command);
		openDatabaseSession();
		OResultSet rs;

		rs = databaseSession.execute("sql", command, args);
		rs.close(); // REMEMBER TO ALWAYS CLOSE THE RESULT SET!!!

		List<OElement> resultList = new ArrayList<>();
		while (rs.hasNext()) {
			OResult item = rs.next();
			OElement result = item.toElement();
			resultList.add(result);
		}

		return resultList;
	}

Actual behavior

I've got a Read Time Out exception when I execute that. I wand to clarify, i use this executeCommand() at another places, and i've no trouble. Just here, I recover the return value.
Here the entire slack :

23-Jul-2019 16:01:31.047 INFO [http-nio-8080-exec-2] com.orientechnologies.common.log.OLogManager.log Caught Network I/O errors on orientdb:2424/dossard, trying an automatic reconnection... (error: Read timed out)
2019-07-23T16:01:31,069 ERROR [http-nio-8080-exec-2] o.s.b.w.s.s.ErrorPageFilter: Forwarding to error page from request [/api/graphs/project/88/graph] due to exception [Read timed out]
com.orientechnologies.common.io.OIOException: Read timed out
	at com.orientechnologies.orient.client.remote.OStorageRemote.baseNetworkOperation(OStorageRemote.java:450)
	at com.orientechnologies.orient.client.remote.OStorageRemote.networkOperationRetryTimeout(OStorageRemote.java:331)
	at com.orientechnologies.orient.client.remote.OStorageRemote.networkOperationNoRetry(OStorageRemote.java:361)
	at com.orientechnologies.orient.client.remote.OStorageRemote.execute(OStorageRemote.java:1080)
	at com.orientechnologies.orient.core.db.document.ODatabaseDocumentRemote.execute(ODatabaseDocumentRemote.java:434)
	at fr.agilea.dossard.graph.orient.OrientDBManager.executeCommand(OrientDBManager.java:408)
	at fr.agilea.dossard.graph.dossard.DossardBaseManager.getNeighbourByNode(DossardBaseManager.java:834)
	at fr.agilea.dossard.rest.controllers.GraphController.getGraphByProjectId(GraphController.java:79)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
	at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
	at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
	at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
	at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:130)
	at org.springframework.boot.web.servlet.support.ErrorPageFilter.access$000(ErrorPageFilter.java:66)
	at org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:105)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:123)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:668)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.SocketTimeoutException: Read timed out
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
	at java.net.SocketInputStream.read(SocketInputStream.java:171)
	at java.net.SocketInputStream.read(SocketInputStream.java:141)
	at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
	at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
	at java.io.DataInputStream.readInt(DataInputStream.java:387)
	at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.readBytes(OChannelBinary.java:163)
	at com.orientechnologies.orient.core.serialization.serializer.result.binary.OResultSerializerNetwork.fromStream(OResultSerializerNetwork.java:657)
	at com.orientechnologies.orient.client.remote.message.OMessageHelper.readProjection(OMessageHelper.java:503)
	at com.orientechnologies.orient.client.remote.message.OMessageHelper.readResult(OMessageHelper.java:471)
	at com.orientechnologies.orient.client.remote.message.OQueryResponse.read(OQueryResponse.java:73)
	at com.orientechnologies.orient.client.remote.OStorageRemote.lambda$networkOperationRetryTimeout$2(OStorageRemote.java:349)
	at com.orientechnologies.orient.client.remote.OStorageRemote.baseNetworkOperation(OStorageRemote.java:407)
	... 107 more
@StevenHeven
Copy link
Author

Nobody have an idea ?

@wolf4ood
Copy link
Member

Hi @StevenHeven

is this happens regularly ? Do you have some exception on the logs of the server?

Are you using the same version java client and orientdb server 3.0.18?

Thanks

@StevenHeven
Copy link
Author

It's happen all the time, and this command it's always in error on execution on production.

The stack above is on the logs of the server. And yes, it's same version of java and orientdb on server and client.

@StevenHeven
Copy link
Author

Any idea ?

@wolf4ood
Copy link
Member

wolf4ood commented Aug 8, 2019

Hi @StevenHeven

let me try to replicate it

Thanks

@StevenHeven
Copy link
Author

You want more info to try to replicate it ?

@wolf4ood
Copy link
Member

wolf4ood commented Aug 8, 2019

@StevenHeven
Let me try to run a query similar to yours on my box.

If it will not fail i will ask for more info

Thanks

@wolf4ood
Copy link
Member

wolf4ood commented Aug 8, 2019

Hi @StevenHeven

i think i've reproduced it. I think there is an issue in the serialization part of the result set of the script. I will work on a fix

Meanwhile you can rewrite the script with a single query to workaround it, which actually seems more idiomatic. You can use nested projection on the relationships and build a custom output on the list of neighbours. See here for more info

SELECT @rid,out("ProjectEdge"):{*} from [#34:20,#25:1735,...];

@StevenHeven
Copy link
Author

@wolf4ood oh okey, thanks for your answer !
I finish my tickets on another features and I'll come back to check your query ! I didn't know these projections concept in OrientDB

I will come to you to telle you if query do the job ;)

Thanks again !

@StevenHeven
Copy link
Author

StevenHeven commented Aug 12, 2019

Hi @wolf4ood ,

I tried your conturnment but ... i've got trouble.
Indeed, i tried this query on Studio :

SELECT EXPAND(out("ProjectEdge")):{*} FROM [#80:1109,#79:1109,#78:1110,#76:1110,#75:1110,#74:1110,#73:1110,#80:1110,#79:1110,#78:1111,#77:1111,#72:410,#75:1113,#72:411,#76:1113,#75:1111,#74:1111,#72:409,#80:1113,#80:1111,#72:412,75:1112,#76:1112,#79:1111,#78:1112,#77:1112,#74:1112,#73:1112,#79:1112,#78:1113,#77:1113,#79:1113,#74:1113,#73:1113,#78:1114,#77:1114,#76:1114, #73:1120 ] limit -1

It works well and give me in return what i wanted.
But , in localhost, when i'm executing by my code in Java, i've got an OCommandSQLParsingException / .
This is the entire stack :

SELECT EXPAND(out("ProjectEdge")):{*} FROM [#105:35, #80:1109, #79:1109, #78:1110, #76:1110, #75:1110, #74:1110,  #73:1110,  #80:1110,  #79:1110,  #78:1111,  #77:1111,  #72:410,  #75:1113,  #72:411,  #76:1113,  #75:1111,  #74:1111,  #72:409,  #80:1113,  #80:1111,  #72:412,  #75:1112,  #76:1112,  #79:1111, #78:1112,  #77:1112,  #74:1112, #73:1112, #79:1112, #78:1113, #77:1113, #79:1113, #74:1113, #73:1113, #78:1114, #77:1114, #76:1114,  #73:1120, ] limit -1
Encountered " <FROM> "FROM "" at line 1, column 39.
Was expecting one of:
     <EOF> 
     <LIMIT> ...
    <SKIP2> ...
    <OFFSET> ...
    <TIMEOUT> ...
    <AS> ...
    <FETCHPLAN> ...
    <LOCK> ...
    <LET> ...
    <NOCACHE> ...
    <PARALLEL> ...
    <UNWIND> ...
    ";" ...
    "," ...
    <AS> ...
    "," ...
    <AS> ...
    
	DB name="dossard"
	Error Code="1"] with root cause 

So ... I don't understand what there is this mystake.

Can you find the fix for command batch told before ?

@luigidellaquila
Copy link
Member

Hi @StevenHeven

I think the problem here is just the comma at the end:

#73:1120, ] limit -1

Thanks

Luigi

@StevenHeven
Copy link
Author

@luigidellaquila oh thanks, it's that ! Sorry for this mistake...

@StevenHeven
Copy link
Author

I came back because this solution doesn't for what I wanted.
Indeed, If I do this, it's to find the neighbouring vertex(s) of a vertex in focus. With this request, I have all the neighbors at once, and therefore no way to find the good neighbors by vextex browsed.
That's why the batch script was good for having ArrayList by vextex focus.

Because I build my own nodes and links in backend for client which it's build with d3 library like that :

@GetMapping("/project/{projectId}/graph")
	public ResponseEntity getGraphByProjectId(@PathVariable("projectId") Integer projectId) {

		// Get project from Postgres Database
		Project projectNeed = projectManager.findProjectbyId(projectId);

		ORID oridNeed = new ORecordId(projectNeed.getRootProjectId());

		// Get RootProject from OrientDb Database
		RootProject rootProject = dossardBaseManager.getRootProjectById(oridNeed);

		// Get all vertex from project
		String query = "Traverse out(\"" + ProjectEdge.class.getSimpleName() + "\") from " + rootProject.getId() + " while (validated != false)";
		List<ProjectVertex> projectObjects = orientDBManager.executeQueryWithReturnType(ProjectVertex.class, query);

		// Get neighbour by node through query execute by DossardBaseManager
		List<ProjectVertex> vertexFound = dossardBaseManager.getNeighbourByNode(projectObjects);


		// Initialize list of future node, future links and list of ID already past
		ArrayList<NodeGraph> nodeGraphList = new ArrayList<>();
		ArrayList<LinkGraph> linksGraphList = new ArrayList<>();
		List<ORID> listOfIdNodes = new ArrayList<>();

		// We iterate on all arrays
		for (int i = 0; i < vertexFound.size(); i++) {

				ProjectVertex projectVertex = vertexFound.get(i);

				// We create instance of Element or Set
				if (Element.class.isAssignableFrom(projectVertex.getClass())) {
					Element element = new Element();
					element.setId(projectVertex.getId());
					element.setName(((Element) projectVertex).getName());

					Object type = ((Element) projectVertex).getType();
					if (TypeEnum.FACT.toString().equals(type)) {
						element.setType(TypeEnum.FACT);
					} else if (TypeEnum.CONFLICT.toString().equals(type)) {
						element.setType(TypeEnum.CONFLICT);
					} else if (TypeEnum.UNDESIRED.toString().equals(type)) {
						element.setType(TypeEnum.UNDESIRED);
					} else if (TypeEnum.INTERMEDIATE.toString().equals(type)) {
						element.setType(TypeEnum.INTERMEDIATE);
					}

					element.setDate(projectVertex.getDate());
				} else if (Set.class.getSimpleName().equals(projectVertex.getClass())) {
					Set set = new Set();
					set.setId(projectVertex.getId());
					set.setDate(projectVertex.getDate());
				}



				// We create nodes & links object with values of vertex neighbour
				if (null == projectVertex.getValidated() || projectVertex.getValidated()) {
					NodeGraph node;

					if (Element.class.isAssignableFrom(projectVertex.getClass())) {
						Element myElement = (Element) projectVertex;

						// Made nodes with OrientDB BackEnd
						node = new NodeGraph(myElement.getId().toString(), myElement.getName(), myElement.getType().getTypeName());
					} else {
						node = new NodeGraph(projectVertex.getId().toString(), TypeQuestionEnum.AND.getType(), TypeQuestionEnum.AND.getType());
					}
					if (!nodeGraphList.contains(node)) {
						nodeGraphList.add(node);
					}
					listOfIdNodes.add(projectVertex.getId());

					//Made links with OrientDB BackEnd
					if (!RootProject.class.isAssignableFrom(projectObjects.get(i).getClass())) {
						if (listOfIdNodes.contains(projectObjects.get(i).getId()) && listOfIdNodes.contains(projectVertex.getId())) {
							LinkGraph linkGraph = new LinkGraph(projectObjects.get(i).getId().toString(), projectVertex.getId().toString());
							if (!linksGraphList.contains(linkGraph)) {
								linksGraphList.add(linkGraph);
							}
						}
					}
				}
			}

		// We create an instance of Graph Object with nodes and links created before
		Graph graph = new Graph(projectNeed.getRootProjectId());
		graph.setNodes(nodeGraphList);
		graph.setLinks(linksGraphList);


		return new ResponseEntity<>(graph, HttpStatus.OK);
	}

Did you found the fix or not ? Or maybe you've got another solutions ?

@StevenHeven
Copy link
Author

Hi,

I was in holiday and I want to have some news if you have a fix of command's serialization ?

Have a good day.

@StevenHeven
Copy link
Author

StevenHeven commented Sep 18, 2019

Up @wolf4ood or @luigidellaquila ...

@StevenHeven
Copy link
Author

I see you removed label ... so you're on bugfix ?

Sorry for spam, but my client wait for this ... it's really slow on server and this command fixed the slowness.
Do you just say to me what's the status ?

Thanks in advance ^^

@StevenHeven
Copy link
Author

StevenHeven commented Dec 12, 2019

up @wolf4ood .... do you got some news ?

@StevenHeven
Copy link
Author

Hi @wolf4ood , I up this topic because my project touch to the end, ... if you found the bugfix , it will be great !

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

4 participants