Closed 4np closed 6 years ago
On Ubuntu Linux (16.04 LTS) I see different behaviour:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.4 LTS
Release: 16.04
Codename: xenial
$ uname -a
Linux ripcurl 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ swift --version
Swift version 4.1-dev (LLVM 1c8b50929b, Clang 8be462d5b8, Swift f2049df523)
Target: x86_64-unknown-linux-gnu
$
1. Build and run
$ swift build
...
$ .build/x86_64-unknown-linux/debug/Run
Running development build on linux (non-release, debug mode)
Using PostgreSQLDatabaseConfig without password
Migrating psql DB
Fatal error: Error raised at top level: ⚠️ PostgreSQL Error: Password is required
- id: PostgreSQLError.password
: file /home/buildnode/jenkins/workspace/oss-swift-4.1-package-linux-ubuntu-16_04/swift/stdlib/public/core/ErrorType.swift, line 191
Current stack trace:
0 libswiftCore.so 0x00007fb657da7080 _swift_stdlib_reportFatalErrorInFile + 221
1 libswiftCore.so 0x00007fb657b1634c <unavailable> + 1368908
2 libswiftCore.so 0x00007fb657d4fd32 <unavailable> + 3702066
3 libswiftCore.so 0x00007fb657b15a46 <unavailable> + 1366598
4 libswiftCore.so 0x00007fb657d4fc37 <unavailable> + 3701815
5 libswiftCore.so 0x00007fb657b15a46 <unavailable> + 1366598
6 libswiftCore.so 0x00007fb657c82c89 <unavailable> + 2862217
7 libswiftCore.so 0x00007fb657b53850 swift_errorInMain + 318
8 Run 0x00005589f548c531 <unavailable> + 4400433
9 libc.so.6 0x00007fb65558e740 __libc_start_main + 240
10 Run 0x00005589f50cc239 <unavailable> + 467513
Illegal instruction (core dumped)
$ .build/x86_64-unknown-linux/debug/Run --env prod
Running production build on linux (release, debug mode)
Using PostgreSQLDatabaseConfig with password
Migrating psql DB
Migrations complete
[ WARNING ] Debug build mode detected while configured for release environment: production. (Application.swift:60)
[ INFO ] Compile your application with `-c release` to enable code optimizations. (Application.swift:61)
Server starting on http://127.0.0.1:8080
^C $
Observe that when building on Ubuntu, the connection only succeeds if you do supply a password...
2. Build for release and run
$ swift build --configuration release
...
$ .build/x86_64-unknown-linux/release/Run
Running development build on linux (non-release, release mode)
Using PostgreSQLDatabaseConfig without password
Migrating psql DB
[PostgreSQL] dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "Cannot initialize PostgreSQLAuthenticationType from invalid Int32 value 12", underlyingError: nil))
^C $ .build/x86_64-unknown-linux/release/Run --env prod
Running production build on linux (release, release mode)
Using PostgreSQLDatabaseConfig with password
Migrating psql DB
[PostgreSQL] dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "Cannot initialize PostgreSQLAuthenticationType from invalid Int32 value 12", underlyingError: nil))
^C $
Observe that on Ubuntu Linux the release build will also always fail, like on macOS
I was also seeing this bug on master branch, haven't seen it since refactor on nio
branch. 👍 thanks!
This still happen with vapor 3 Thread 1: Fatal error: Error raised at top level: ⚠️ PostgreSQL Error: No password is required
@nhatlee try setting the password to nil in your config.
Connecting to
PostgreSQL
always fails in release builds, and it always fails in debug builds when you supply a password.Steps to reproduce
1. Create user + database:
2. Update configuration Update
configure.swift
to have the following configuration:3. Build and run
Observe that running the
development build
will connect properly when you don't supply a password, but it fails withPostgreSQL Error: No password is required
when you do supply a password.4. Build and run for release
Observe that the
release build
will always fails withCannot initialize PostgreSQLAuthenticationType from invalid Int32 value 8
, regardless of whether or not you supply a password.