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

Feature/160 fmuproxy integration #162

Merged
merged 83 commits into from
Apr 29, 2019
Merged

Conversation

markaren
Copy link
Contributor

@markaren markaren commented Jan 31, 2019

Resolves #160 and #164 .

Adds integration with fmu-proxy using thrift.

Some remarks:

  • thrift does not like debug mode. So you have to run in release. This is the case both for the conan and vcpkg version.
  • I made fmu-proxy integration optional through the CMake option CSECORE_WITH_FMUPROXY

Note: Source files are not formatted and probably do not adhere to the new header convention.

And yeah, you need to add a conan remote to get thrift:
conan remote add helmesjo "https://api.bintray.com/conan/helmesjo/public-conan"

UPDATE:
Setup instructions

@markaren
Copy link
Contributor Author

The warnings from the thrift headers are (MSVC):

  • warning C4245: 'return': conversion from 'int' to 'SOCKET', signed/unsigned mismatch
  • warning C4706: assignment within conditional expression

Ok to suppress?

@markaren
Copy link
Contributor Author

markaren commented Feb 5, 2019

Server executable are now built as part of the CI run.
https://circleci.com/gh/NTNU-IHB/FMU-proxy
The .jar is naturally cross-platform, while the C++ server is only built for linux.

@hplatou
Copy link
Contributor

hplatou commented Mar 20, 2019

I took the liberty to run ClangFormat on all "non-generated" files.

Copy link
Contributor

@hplatou hplatou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to work fine for some fmu's but I get errors when loading others(all FMI v2):

../fmuproxy/fmuproxy_helper.hpp:44: Internal error: Failed to parse variability: ''

As far as I remember variability has a default value of 'continuous'. I also suggest to give a better error message in case of trying to load an v1 FMU. Currently you just get an xml-parser error.

Also, as it is now, it is not possible to use fmuproxy through the C-API/SSP. Nevertheless I suggest we merge this PR and later create a new one for exposing through C-API/SSP-config when needed.

@markaren
Copy link
Contributor Author

As far as I remember variability has a default value of 'continuous'.

I can fix this. It should default to continious if it's empty.

@eidekrist
Copy link
Member

As this branch has many commits, I would suggest to use the "Squash and merge" option when merging 👍

@markaren markaren changed the title Feature/160 fmuproxy integration[WiP - not ready to merge] Feature/160 fmuproxy integration Mar 25, 2019
@markaren
Copy link
Contributor Author

Getting a weird error on Jenkins windows build during debug test:

+ conan upload cse-core/*@osp/feature_160-fmuproxy-integration --all -r=osp --confirm

----------------------------------------

Remote manifest:
Time: 2019-03-20 15:02:27
conanfile.py, MD5: 8a18adaa6ebb4406f311d78dead7c62c

Local manifest:
Time: 2019-03-20 09:20:49
conanfile.py, MD5: db89c9986d373575e43f35b22e998bc3

Local 'conanfile.py' using '\n' line-ends
Remote 'conanfile.py' using '\n' line-ends

----------------------------------------

ERROR: Remote recipe is newer than local recipe: 
 Remote date: 1553094147
 Local date: 1553073649
script returned exit code 1

@kyllingstad
Copy link
Member

We have been trying to run FMU-proxy and the test in this PR according to the guide on confluence, and the test fails. FMU-proxy prints the following message:

> java -jar fmu-proxy.jar -thrift/tcp=9090
 INFO [main] (GrpcFmuServer.kt:78) - GrpcFmuServer listening for connections on port: 57012
 INFO [main] (ThriftFmuServer.kt:83) - ThriftFmuSocketServer listening for connections on port: 9090
 INFO [main] (Log.java:193) - Logging initialized @2904ms to org.eclipse.jetty.util.log.Slf4jLog
 INFO [main] (ThriftFmuServer.kt:83) - ThriftFmuServlet listening for connections on port: 57063
 INFO [Thread-5] (Server.java:374) - jetty-9.4.z-SNAPSHOT; built: 2018-06-05T18:24:03.829Z; git: d5fc0523cfa96bfebfbda19606cad384d772f04c; jvm 1.8.0_101-b13
 INFO [main] (RpcHttpServer.kt:60) - FmuProxyJsonHttpServer for connections on port: 57070
 INFO [main] (RpcWebSocketServer.kt:57) - FmuProxyJsonWsServer listening for connections on port: 57073
 INFO [main] (RpcTcpServer.kt:54) - FmuProxyJsonTcpServer listening for connections on port: 57074
 INFO [Thread-5] (AbstractConnector.java:289) - Started ServerConnector@14246a5{HTTP/1.1,[http/1.1]}{0.0.0.0:57063}
 INFO [Thread-5] (Server.java:411) - Started @3077ms
 INFO [main] (RpcZmqServer.kt:86) - FmuProxyJsonZmqServer listening for connections on port: 57077
Press any key to exit..
 WARN [Thread-2] (AbstractNonblockingServer.java:544) - Got an IOException in internalRead!
java.io.IOException: An existing connection was forcibly closed by the remote host
        at sun.nio.ch.SocketDispatcher.read0(Native Method)
        at sun.nio.ch.SocketDispatcher.read(Unknown Source)
        at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source)
        at sun.nio.ch.IOUtil.read(Unknown Source)
        at sun.nio.ch.SocketChannelImpl.read(Unknown Source)
        at org.apache.thrift.transport.TNonblockingSocket.read(TNonblockingSocket.java:141)
        at org.apache.thrift.server.AbstractNonblockingServer$FrameBuffer.internalRead(AbstractNonblockingServer.java:539)
        at org.apache.thrift.server.AbstractNonblockingServer$FrameBuffer.read(AbstractNonblockingServer.java:338)
        at org.apache.thrift.server.AbstractNonblockingServer$AbstractSelectThread.handleRead(AbstractNonblockingServer.java:203)
        at org.apache.thrift.server.TThreadedSelectorServer$SelectorThread.select(TThreadedSelectorServer.java:591)
        at org.apache.thrift.server.TThreadedSelectorServer$SelectorThread.run(TThreadedSelectorServer.java:546)

We have tried on multiple machines with the same result, using both file:// and http:// FMU URLs. Any ideas what could be wrong?

@markaren
Copy link
Contributor Author

markaren commented Apr 4, 2019 via email

@kyllingstad
Copy link
Member

Probably a version mismatch. It needs master, but apperantly artifacts from circlrci are not available for others. How did you get it? When Halvor tested it, I sent a matching build to him.

I got it from @hplatou. And he has also tried this today, and got the same error message.

@markaren
Copy link
Contributor Author

markaren commented Apr 4, 2019 via email

@kyllingstad
Copy link
Member

Great, that fixed it. If you have a version of the fmu-proxy server that is compatible with the most recent commits, it would be great if you could post it on Slack at some point in the near future. :)

@markaren
Copy link
Contributor Author

markaren commented Apr 4, 2019 via email

cmake/FindThrift.cmake Outdated Show resolved Hide resolved
@markaren
Copy link
Contributor Author

markaren commented Apr 4, 2019 via email

@markaren
Copy link
Contributor Author

markaren commented Apr 22, 2019

This PR cannot be merged before the Jenkins error is fixed. See error in comment above.
@hplatou, @kyllingstad

@markaren markaren merged commit 13295fd into master Apr 29, 2019
@markaren markaren deleted the feature/160-fmuproxy-integration branch May 7, 2019 07:56
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

Successfully merging this pull request may close these issues.

Create fmu-proxy integration demo
4 participants