Closed Srid68 closed 5 months ago
when you say it doesn't work - you try to run the artifact with 'ops run' and it crashes? if so can you paste what you see?
also, if you want to modify or add one of these examples we accept prs
Hi Ian,
I have a core dump as shown below when using dotnet publish -c release --self-contained --runtime linux-x64 -o ./publish -p:PublishSingleFile=true
I also tested a basic default minimal api using both normal compilation and nativeaot compilation, it starts properly but cannot connect to the server. Not sure what is the issue.
***@***.***:~/ops/ops-examples/dotnet/MyApi$ curl http://127.0.0.1:8080
curl: (7) Failed to connect to 127.0.0.1 port 8080 after 0 ms: Connection refused
Any help appreciated.
Best Regards, Sridharan Srinivasan
Minimal API on ops run -c config.json publish/myApi
warning: overwriting existing file publish/appsettings.Development.json hostpath old: publish/publish/appsettings.Development.json new: publish/appsettings.Development.json warning: overwriting existing file publish/appsettings.json hostpath old: publish/publish/appsettings.json new: publish/appsettings.json warning: overwriting existing file publish/config.json hostpath old: publish/publish/config.json new: publish/config.json warning: overwriting existing file lib/x86_64-linux-gnu/libpthread.so.0 hostpath old: /home/arshu/ops/ops-examples/dotnet/myApi/lib/x86_64-linux-gnu/libpthread.so.0 new: /lib/x86_64-linux-gnu/libpthread.so.0 running local instance booting /home/arshu/.ops/images/MyApi ... en1: assigned 10.0.2.15 info: Microsoft.Hosting.Lifetime[14] Now listening on: http://127.0.0.1:8080 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Production info: Microsoft.Hosting.Lifetime[0] Content root path: / en1: assigned FE80::9C54:2AFF:FE57:89B7
But curl http://127.0.0.1:8080 http://127.0.0.1:8080/ does not work and shows below message.
Console APP core dump on ops run -c config.json publish/myApp
warning: overwriting existing file lib/x86_64-linux-gnu/librt.so.1 hostpath old: /home/arshu/ops/ops-examples/dotnet/myApp/lib/x86_64-linux-gnu/librt.so.1 new: /lib/x86_64-linux-gnu/librt.so.1 warning: overwriting existing file lib/x86_64-linux-gnu/libpthread.so.0 hostpath old: /home/arshu/ops/ops-examples/dotnet/myApp/lib/x86_64-linux-gnu/libpthread.so.0 new: /lib/x86_64-linux-gnu/libpthread.so.0 running local instance booting /home/arshu/.ops/images/myApp ... en1: assigned 10.0.2.15 Unhandled exception. System.BadImageFormatException: Bad IL format. The format of the file '/publish/myApp.dll' is invalid.
*** signal 6 received by tid 2, errno 0, code -6
*** Thread context: lastvector: 00000000000000ea frame: ffffc00002a01800 type: thread active_cpu: 00000000ffffffff stack top: 0000000000000000
rax: 0000000000000000 rbx: 000000010000b880 rcx: 0000000000000001 rdx: 0000000000000006 rsi: 0000000000000002 rdi: 0000000000000002 rbp: 0000000000000002 rsp: 00000000ffeee270 r8: 00000000ffeee340 r9: 0000000000000000 r10: 0000000000000008 r11: 970e4a95b4605c51 r12: 0000000000000006 r13: 0000000000000016 r14: 0000000000000006 r15: 00000000ffeee660 rip: 00000001000ff9fc rflags: 0000000000000246 ss: 000000000000002a cs: 0000000000000023 ds: 0000000000000000 es: 0000000000000000 fsbase: 000000010000b880 gsbase: 0000000000000000
frame trace:
kernel load offset ffffffffde2e6000
loaded klibs:
stack trace: 00000000ffeee270: ffffffffffffffff 00000000ffeee278: 0000000000000001 00000000ffeee280: 0000000001070580 00000000ffeee288: 000000010000b870 00000000ffeee290: 00000000ffeee420 00000000ffeee298: 0000000000000000 00000000ffeee2a0: 0000000000000000 00000000ffeee2a8: 00000000014cf790 00000000ffeee2b0: ffffffffffffffff 00000000ffeee2b8: 0000000000000001 00000000ffeee2c0: 00000000014cf790 00000000ffeee2c8: 0000000000000000 00000000ffeee2d0: 00610068006e0055 00000000ffeee2d8: 0065006c0064006e 00000000ffeee2e0: 0078006500200064 00000000ffeee2e8: 000000001d903bf8 00000000ffeee2f0: 00000000ffeee300 00000000ffeee2f8: 74ef96a51808ea00 00000000ffeee300: 000000010000b880 00000000ffeee308: 0000000000000006 00000000ffeee310: 0000000000000000 00000000ffeee318: 0000000000000000 00000000ffeee320: 0000000000000006 00000000ffeee328: 00000001000ab476 00000000ffeee330: 0000000100284e90 00000000ffeee338: 00000001000917f3 00000000ffeee340: 0000000000000020 00000000ffeee348: 0000000000000000 00000000ffeee350: 0000000001497de0 00000000ffeee358: 00000000ffeee258 00000000ffeee360: 000000000105a340 00000000ffeee368: 00000000014a2a50
core dump
On 10 May 2024, at 11:39 AM, Ian Eyberg @.***> wrote:
when you say it doesn't work - you try to run the artifact with 'ops run' and it crashes? if so can you paste what you see?
— Reply to this email directly, view it on GitHub https://github.com/nanovms/ops-examples/issues/152#issuecomment-2103800172, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEKQR3VABW5L346TSZ3QGTZBQ6N3AVCNFSM6AAAAABHP4BRB6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBTHAYDAMJXGI. You are receiving this because you authored the thread.
Hi Ian,
I created a minimal api using "dotnet new webapiaot -o myApi”. I compiled both with AOT and Non-AOT
Then I use ops run -p 8080 -c config.json publish/myApi to run a minimal api
The minimal api runs properly with correct log messages but cannot access the api
@.***:~$ curl http://127.0.0.1:8080 curl: (56) Recv failure: Connection reset by peer
Any help appreciated.
Best Regards, Sridharan Srinivasan
On 10 May 2024, at 2:23 PM, Sri @.***> wrote:
Hi Ian,
I have a core dump as shown below when using dotnet publish -c release --self-contained --runtime linux-x64 -o ./publish -p:PublishSingleFile=true
I also tested a basic default minimal api using both normal compilation and nativeaot compilation, it starts properly but cannot connect to the server. Not sure what is the issue.
@.***:~/ops/ops-examples/dotnet/MyApi$ curl http://127.0.0.1:8080 curl: (7) Failed to connect to 127.0.0.1 port 8080 after 0 ms: Connection refused
Any help appreciated.
Best Regards, Sridharan Srinivasan
Minimal API on ops run -c config.json publish/myApi
warning: overwriting existing file publish/appsettings.Development.json hostpath old: publish/publish/appsettings.Development.json new: publish/appsettings.Development.json warning: overwriting existing file publish/appsettings.json hostpath old: publish/publish/appsettings.json new: publish/appsettings.json warning: overwriting existing file publish/config.json hostpath old: publish/publish/config.json new: publish/config.json warning: overwriting existing file lib/x86_64-linux-gnu/libpthread.so.0 hostpath old: /home/arshu/ops/ops-examples/dotnet/myApi/lib/x86_64-linux-gnu/libpthread.so.0 new: /lib/x86_64-linux-gnu/libpthread.so.0 running local instance booting /home/arshu/.ops/images/MyApi ... en1: assigned 10.0.2.15 info: Microsoft.Hosting.Lifetime[14] Now listening on: http://127.0.0.1:8080 info: Microsoft.Hosting.Lifetime[0] Application started. Press Ctrl+C to shut down. info: Microsoft.Hosting.Lifetime[0] Hosting environment: Production info: Microsoft.Hosting.Lifetime[0] Content root path: / en1: assigned FE80::9C54:2AFF:FE57:89B7
But curl http://127.0.0.1:8080 http://127.0.0.1:8080/ does not work and shows below message.
Console APP core dump on ops run -c config.json publish/myApp
warning: overwriting existing file lib/x86_64-linux-gnu/librt.so.1 hostpath old: /home/arshu/ops/ops-examples/dotnet/myApp/lib/x86_64-linux-gnu/librt.so.1 new: /lib/x86_64-linux-gnu/librt.so.1 warning: overwriting existing file lib/x86_64-linux-gnu/libpthread.so.0 hostpath old: /home/arshu/ops/ops-examples/dotnet/myApp/lib/x86_64-linux-gnu/libpthread.so.0 new: /lib/x86_64-linux-gnu/libpthread.so.0 running local instance booting /home/arshu/.ops/images/myApp ... en1: assigned 10.0.2.15 Unhandled exception. System.BadImageFormatException: Bad IL format. The format of the file '/publish/myApp.dll' is invalid.
*** signal 6 received by tid 2, errno 0, code -6
*** Thread context: lastvector: 00000000000000ea frame: ffffc00002a01800 type: thread active_cpu: 00000000ffffffff stack top: 0000000000000000
rax: 0000000000000000 rbx: 000000010000b880 rcx: 0000000000000001 rdx: 0000000000000006 rsi: 0000000000000002 rdi: 0000000000000002 rbp: 0000000000000002 rsp: 00000000ffeee270 r8: 00000000ffeee340 r9: 0000000000000000 r10: 0000000000000008 r11: 970e4a95b4605c51 r12: 0000000000000006 r13: 0000000000000016 r14: 0000000000000006 r15: 00000000ffeee660 rip: 00000001000ff9fc rflags: 0000000000000246 ss: 000000000000002a cs: 0000000000000023 ds: 0000000000000000 es: 0000000000000000 fsbase: 000000010000b880 gsbase: 0000000000000000
frame trace:
kernel load offset ffffffffde2e6000
loaded klibs:
stack trace: 00000000ffeee270: ffffffffffffffff 00000000ffeee278: 0000000000000001 00000000ffeee280: 0000000001070580 00000000ffeee288: 000000010000b870 00000000ffeee290: 00000000ffeee420 00000000ffeee298: 0000000000000000 00000000ffeee2a0: 0000000000000000 00000000ffeee2a8: 00000000014cf790 00000000ffeee2b0: ffffffffffffffff 00000000ffeee2b8: 0000000000000001 00000000ffeee2c0: 00000000014cf790 00000000ffeee2c8: 0000000000000000 00000000ffeee2d0: 00610068006e0055 00000000ffeee2d8: 0065006c0064006e 00000000ffeee2e0: 0078006500200064 00000000ffeee2e8: 000000001d903bf8 00000000ffeee2f0: 00000000ffeee300 00000000ffeee2f8: 74ef96a51808ea00 00000000ffeee300: 000000010000b880 00000000ffeee308: 0000000000000006 00000000ffeee310: 0000000000000000 00000000ffeee318: 0000000000000000 00000000ffeee320: 0000000000000006 00000000ffeee328: 00000001000ab476 00000000ffeee330: 0000000100284e90 00000000ffeee338: 00000001000917f3 00000000ffeee340: 0000000000000020 00000000ffeee348: 0000000000000000 00000000ffeee350: 0000000001497de0 00000000ffeee358: 00000000ffeee258 00000000ffeee360: 000000000105a340 00000000ffeee368: 00000000014a2a50
core dump
On 10 May 2024, at 11:39 AM, Ian Eyberg @.***> wrote:
when you say it doesn't work - you try to run the artifact with 'ops run' and it crashes? if so can you paste what you see?
— Reply to this email directly, view it on GitHub https://github.com/nanovms/ops-examples/issues/152#issuecomment-2103800172, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEKQR3VABW5L346TSZ3QGTZBQ6N3AVCNFSM6AAAAABHP4BRB6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBTHAYDAMJXGI. You are receiving this because you authored the thread.
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://127.0.0.1:8080/
w/out seeing your code not sure where to change but this indicates your listen address needs to change from '127.0.0.1' to the any address of '0.0.0.0'
you need to set this at the top of publish/appsettings.json:
"Urls": "http://0.0.0.0:8082",
ops run -p 8082 -c config.json publish/myApi
then you should be able to hit it:
curl -XGET http://127.0.0.1:8082/todos | jq
Hi Ian,
It is working. Thanks.
Best Regards, Sridharan Srinivasan
On 12 May 2024, at 1:03 AM, Ian Eyberg @.***> wrote:
you need to set this at the top of publish/appsettings.json:
"Urls": "http://0.0.0.0:8080", ops run -p 8082 -c config.json publish/myApi then you should be able to hit it:
curl -XGET http://127.0.0.1:8082/todos | jq — Reply to this email directly, view it on GitHub https://github.com/nanovms/ops-examples/issues/152#issuecomment-2105956004, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEKQRYCFMJSSUCWE3X2HZLZBZFOFAVCNFSM6AAAAABHP4BRB6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBVHE2TMMBQGQ. You are receiving this because you authored the thread.
I installed OPS in Ubuntu 22.04 bare metal server and followed the instructions in botnet Hello World Project by creating a new Console Project myApp
I had to copy the libraries specified in config.json with the updated version and path under myApp folder.
{ "Files": [ "lib/x86_64-linux-gnu/librt.so.1", "lib/x86_64-linux-gnu/libicuuc.so.70.1", "lib/x86_64-linux-gnu/libicui18n.so.70.1", "lib/x86_64-linux-gnu/libicudata.so.70.1", "lib/x86_64-linux-gnu/libssl.so.3", "lib/x86_64-linux-gnu/libcrypto.so.3", "lib/x86_64-linux-gnu/libpthread.so.0",
"lib/x86_64-linux-gnu/libnuma.so.1" ], "MapDirs": {"publish/*": "/" }, "Dirs": ["publish"], "Env": { "COMPlus_EnableDiagnostics": "0" } }
I had to change the myApp.csproj file with option to disabletrue
Then if I compile using dotnet publish -c release --self-contained --runtime linux-x64 -o ./publish
and run using ops run -c config.json publish/myApp it works
Updating the project to use PublishAot and compiling and running also works
But compiling using dotnet publish -c release --self-contained --runtime linux-x64 -o ./publish -p:PublishSingleFile=true does not work