Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008959opensim[REGION] OpenSim Corepublic2022-01-10 05:042022-01-13 12:42
ReporterLotek 
Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusconfirmedResolutionopen 
PlatformLinuxOperating SystemUbuntuOperating System Version20.04 LTS
Product Version 
Target VersionFixed in Version 
Summary0008959: Postgresql won't load, something with a certificatecallback
DescriptionI tried postgresql, on a standard Ubuntu 20.04 system with Postgresql 12 installed from the repos.

I made my pgsql user, gave it a database, and tested that i can access the db with this user on the commandline.

Then I configured OpenSim for postgresql, started it and it bombs out with a huge error about not being able to resolve a certificate selection callback, see attached log.

I also tried 'SSL Mode=disable' in the connection string but that didn't work either.

Is this PEBCAK or is there something wrong with the OpenSim pgsql connector? Possibly outdated?
Additional InformationOpenSim is compiled from master


lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal


psql --version
psql (PostgreSQL) 12.9 (Ubuntu 12.9-0ubuntu0.20.04.1)

 mono --version
Mono JIT compiler version 6.8.0.105 (Debian 6.8.0.105+dfsg-2 Wed Feb 26 23:23:50 UTC 2020)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS: __thread
        SIGSEGV: altstack
        Notifications: epoll
        Architecture: amd64
        Disabled: none
        Misc: softdebug
        Interpreter: yes
        LLVM: supported, not enabled.
        Suspend: hybrid
        GC: sgen (concurrent by default)
TagsNo tags attached.
Git Revision or version number
Run Mode Grid (1 Region per Sim)
Physics EngineubODE
Script EngineYEngine
EnvironmentMono / Linux64
Mono VersionNone
Viewer
Attached Fileslog file icon pgsql21.log [^] (6,515 bytes) 2022-01-10 05:07
txt file icon error-postgres.txt [^] (7,232 bytes) 2022-01-12 16:35 [Show Content]

- Relationships

-  Notes
(0038326)
tampa (reporter)
2022-01-10 11:44

Current trunk should be 6.12 for mono, tried updating to that?
(0038327)
Lotek (reporter)
2022-01-12 08:48

@tampa Good suggestion, unfortunately the same error with mono 6.12
(0038328)
tampa (reporter)
2022-01-12 09:50

Connecting over localhost it is a bit weird it is even trying to load a cert in the first place. Not having used postgres all that much lately, is the database set to be open to the web or bound just to localhost?

The error itself suggest some incompatibility somewhere rather than an implementation issue so I'm not sure where to look first. It sounds a bit more like an issue with the database setup itself not being compatible, perhaps due to the TLS version or something.
(0038329)
tampa (reporter)
2022-01-12 13:06

Just tried this and yeah somethings not right there, but not quite sure what yet, need to get debug builds in to find the breaking point. Certainly, out of the box, does fail with the same error though.
(0038330)
tampa (reporter)
2022-01-12 16:34

Went and compiled mono from trunk on the system in hopes was just missing something in mono.security, but no dice either. Even disabling everything that has to do with certs via the connection string has not shown any different error.

Really strange, but I for one am out of ideas on what else it could be. According to npsql the implementation within OpenSim is proper and the point of failure in SimulationDataStore is right at the init for the connection object is done.

Adding a more detailed log
(0038331)
evilissimo (reporter)
2022-01-13 02:36

@Lotek shouldn't that be "sslmode=disable" instead of 'SSL Mode=disable'
(0038332)
Lotek (reporter)
2022-01-13 09:33

@evilissimo the docs for the .dll state it to be 'SSL Mode'. Also 'Username' instead of 'User ID' and 'Host' instead of 'Server'.
https://www.npgsql.org/doc/connection-string-parameters.html [^]

I suspect now the Npgsql.dll opensim uses is older and doesn't work with modern postgresql. The 6.0 release of Npgsql seems to be for .NET 6, but I was able to build 5.0. I don't know enough about NET and C# to proceed any further.
(0038333)
tampa (reporter)
2022-01-13 10:54

Using Npgsql.dll 3.2.7 and supplying the for some reason missing System.Threading.Tasks.Extension and System.Runtime.CompilerServices.Unsafe to it does mean OpenSim once again loads in standalone mode, with the only error being of a uuid to uuid conversion in useraccounts or useragents somewhere.

It would appear that indeed we need to find a different version of Npgsql to compile for the SimulationData part for Postgres to work. Not sure what exactly changed there to cause this in the first place.

Even newer versions of Npgsql require even more dependencies, which just seem to bloat things up as well, so I'll see what the oldest version is that works in hopes it doesn't need the mentioned dependencies as they seem to be non-standard dependencies not normally found on most systems, at least referencing them in prebuild only yields ref not found errors.

If 3.2.7 ends up being a good version to use someone will need to fix the issue with the uuid to uuid conversion, which seems to no longer be proper.

4.1.9 is the latest version that has a .net 461 version, all others after that are compiled against net core and netstandard or net5-6
(0038334)
UbitUmarov (administrator)
2022-01-13 11:03
edited on: 2022-01-13 11:04

code for net5 will not work on mono/net framework 4x

careful adding System.Runtime.CompilerServices.Unsafe to 4.8
docs seem to say it is ok, but other documentation tell is is NOT

that dll is in fact a hack, it uses direct coded IL to create crude direct pointers. The IL opcodes where not meant to be used like that. The DOTnet 5/& do have modified code to handle that use, 4.x does not

You need dlls for normal 4.x framework, otherwise those new versions are just NOT SUPPORTED

(0038335)
tampa (reporter)
2022-01-13 11:26

Like I said, going back versions to find one that works out of the box, but it seems that is not going to happen. Anything below 3.2.0 fails to load because Postgres auth is too new and unsupported. Anything above 3.2.7 wants all manners of extra dlls it depends on.

3.2.7 is the newest and least demanding version, but it still wants those two dlls in order to work. The only option is to fetch source of Npgsql and attempt to remove the need for said dlls from it and build it manually.

https://github.com/npgsql/npgsql/releases?page=5 [^] Has source for 3.2.7 with a solution for building. I will load that up, remove the namespaces for said dlls and attempt to fix the compile errors, but seeing as I am unfamiliar with that it might be best if someone more used to that sort of thing tries as well as I have no idea how well this will work.

I tried even older versions of Npgsql, but they all fail with unsupported auth or go back to the initially reported error.
(0038336)
tampa (reporter)
2022-01-13 12:42

Trying to remove said two namespaces from 3.2.7 yields 2175 compile errors to fix in order to get a Npgsql.dll without them. Not sure I'm up to doing all that, though I think some of this is down to vscode missing the devkit for .net extension development so true number might be smaller.

Supplying the two "missing" dlls yields a startup with only one error:

20:02:59 - [SERVER UTILS]: Error loading plugin OpenSim.Services.Interfaces.IUserAccountService from OpenSim.Services.UserAccountService.dll. Exception: Can't convert .NET type OpenMetaverse.UUID to PostgreSQL uuidSystem.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidCastException: Can't convert .NET type OpenMetaverse.UUID to PostgreSQL uuid

Which should be somewhat easy to fix I would imagine. Boots and asks for region name, so outside of that it appears to be running. Haven't tested further so it may throw other errors down the line, hard to say.

Including CompilerServices.Unsafe really isn't an option that seems like a good idea given it's kind of a hack, but any older versions of Npgsql fail with unsupported auth method.

In order to reproduce:

Install ubuntu 20.04 server
Fetch mono-complete from latest stable, 6.12 as of writing
Fetch Postgres stable, 14.1 as of writing
Git clone OpenSim and build, configure standalone and run

Fix:
Download Npgsql 3.2.7 from Nuget and place lib/451 into bin
Download System.Threading.Tasks.Extensions.dll and System.Runtime.CompilerServices.Unsafe from Nuget, latest versions seems to work fine, place in bin as well
Recompile OpenSim and observe above mentioned error

Hope that makes it clear what's going on :)

- Issue History
Date Modified Username Field Change
2022-01-10 05:04 Lotek New Issue
2022-01-10 05:06 Lotek Note Added: 0038325
2022-01-10 05:07 Lotek Note Deleted: 0038325
2022-01-10 05:07 Lotek File Added: pgsql21.log
2022-01-10 11:44 tampa Note Added: 0038326
2022-01-12 08:48 Lotek Note Added: 0038327
2022-01-12 09:50 tampa Note Added: 0038328
2022-01-12 13:06 tampa Note Added: 0038329
2022-01-12 13:06 tampa Status new => confirmed
2022-01-12 16:34 tampa Note Added: 0038330
2022-01-12 16:35 tampa File Added: error-postgres.txt
2022-01-13 02:36 evilissimo Note Added: 0038331
2022-01-13 09:33 Lotek Note Added: 0038332
2022-01-13 10:54 tampa Note Added: 0038333
2022-01-13 11:03 UbitUmarov Note Added: 0038334
2022-01-13 11:04 UbitUmarov Note Edited: 0038334 View Revisions
2022-01-13 11:26 tampa Note Added: 0038335
2022-01-13 12:42 tampa Note Added: 0038336


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker