Comments (13)
You are probably using crystal-mysql 0.3.0, check with the latest 0.3.1.
from crystal-mysql.
Sorry, hadn't run crystal deps update
since my last git pull
, perils of working on 2 machines. It was semi-deliberate to avoid pulling the broken kemal-session-file, but that's been fixed now.
Many thanks... and good luck on the journey to crystal 1.0 in 2017.
from crystal-mysql.
Spoke too soon. Sent to my ci and got the same error. Seems the local fix I made wasn't overwritten by a crystal deps update. For clarification here is my ci output.
Also crystal is on Crystal 0.20.3 (2016-12-23)
gitlab-ci-multi-runner 1.2.0 (3a4fcd4)
Using Shell executor...
Running on cris2.local...
Fetching changes...
Removing .shards/
Removing lib/
HEAD is now at c8e798b updated deps
Checking out c8e798bf as master...
$ crystal deps update
Updating https://github.com/kemalcr/kemal.git
Updating https://github.com/luislavena/radix.git
Updating https://github.com/jeromegn/kilt.git
Updating https://github.com/RX14/multipart.cr.git
Updating https://github.com/jeromegn/slang.git
Updating https://github.com/crystal-lang/crystal-mysql.git
Updating https://github.com/crystal-lang/crystal-db.git
Updating https://github.com/kemalcr/kemal-session-file.git
Updating https://github.com/kemalcr/kemal-session.git
Installing kemal (0.17.4)
Installing radix (0.3.5)
Installing kilt (0.3.3)
Installing multipart (0.1.1)
Installing slang (1.4.1)
Installing mysql (0.3.1)
Installing db (0.3.3)
Installing kemal-session-file (0.3.0)
Installing kemal-session (master)
$ crystal spec -v
Error in spec/spec_helper.cr:10: instantiating 'DB:Module#open(String)'
@@db : DB::Database = DB.open(DBURL)
^~~~
in lib/db/src/db.cr:103: instantiating 'build_database(String)'
build_database(uri)
^~~~~~~~~~~~~~
in lib/db/src/db.cr:117: instantiating 'build_database(URI)'
build_database(URI.parse(connection_string))
^~~~~~~~~~~~~~
in lib/db/src/db.cr:121: instantiating 'DB::Database:Class#new(DB::Driver+, URI)'
Database.new(driver_class(uri.scheme).new, uri)
^~~
in lib/db/src/db/database.cr:50: instantiating 'DB::Driver+#build_connection(DB::Database)'
conn = @driver.build_connection(self).as(Connection)
^~~~~~~~~~~~~~~~
in lib/mysql/src/mysql/driver.cr:3: instantiating 'MySql::Connection:Class#new(DB::Database)'
MySql::Connection.new(db)
^~~
in lib/mysql/src/mysql/connection.cr:22: instantiating 'read_packet(MySql::Protocol::HandshakeV10:Class)'
handshake = read_packet(Protocol::HandshakeV10)
^~~~~~~~~~~
in lib/mysql/src/mysql/connection.cr:57: instantiating 'read_packet()'
read_packet do |packet|
^~~~~~~~~~~
in lib/mysql/src/mysql/connection.cr:47: instantiating 'build_read_packet()'
packet = build_read_packet
^~~~~~~~~~~~~~~~~
in lib/mysql/src/mysql/connection.cr:65: instantiating 'MySql::ReadPacket:Class#new(TCPSocket+, MySql::Connection)'
ReadPacket.new(@socket, self)
^~~
instance variable '@remaining' of MySql::ReadPacket must be Int32, not Nil
Error: instance variable '@remaining' is initialized inside a begin-rescue, so it can potentially be left uninitialized if an exception is raised and rescued
ERROR: Build failed: exit status 1
from crystal-mysql.
I got this as well.
from crystal-mysql.
As a temp fix, feel free to use my branch crisward/crystal-mysql for now.
from crystal-mysql.
Thanks @criward! Will use it 👍
from crystal-mysql.
I would like to be able to reproduce/isolate the issue a little bit more.
ReadPacket declaration in 0.3.1 begins as:
class MySql::ReadPacket
include IO
@length : Int32 = 0
@remaining : Int32 = 0
@seq : UInt8 = 0u8
def initialize(@io : IO, @connection : Connection)
begin
...
rescue IO::EOFError
raise DB::ConnectionLost.new(@connection)
end
end
So the ivars should not be nilable.
Can you both @tbrand @crisward check that there is no cache ~/.crystal
/ ~/.cache
bothering or wrong ./lib/crystal-mysql/src/mysql/read_packet.cr
in your path.
@tbrand what is your environment?
from crystal-mysql.
I deleted my project/.shards
folder and removed everything in ~/.cache/crystal/
, then did a fresh crystal deps
.
It now seems to compile again.
Bit odd it's doing it on my ci server too. I'll have a quick look into it and see if I can find the offending cache.
from crystal-mysql.
No matter what I delete, I can't get it to compile on the ci server. I've deleted every cache I can find, and it's still throws the same error above. It works fine with my fork, just not the main release.
from crystal-mysql.
Just swapped my local copy back to mysql (0.3.1) from my fork, got the same error.
Still using Crystal 0.20.3 (2016-12-23) as one of my upstream dependencies hasn't been updated to 0.20.4.
Update: tried with 0.20.4, same error
from crystal-mysql.
Make sure your crystal version is the same everywhere FWIW...0.20.5 help?
OK I did run into this. The following compiles great:
require "mysql"
def go
db = DB.open "something"
end
However this fails with what appears to be the OP's same message:
require "mysql"
class MyDb
@@db = DB.open "anything"
end
from crystal-mysql.
This is great! it is a bug in the compiler :-). Seriously thanks for sharing some snippets so we can found what was different between yours experiments and mine.
from crystal-mysql.
Since the fix in the compiler my taken a little bit longer, I've just merged #23 to unblock the class var initializers scenario.
from crystal-mysql.
Related Issues (20)
- Unexpected EOF on ubuntu aarch64 HOT 2
- Generic `Exception`s raised in `MySql::Connection` HOT 6
- packet 254 not implemented -- still struggling with
- Release a new version HOT 2
- Crystal 0.24 HOT 4
- call Store procedure HOT 1
- "Client does not support authentication protocol requested by server; consider upgrading MySQL client (Exception)" HOT 7
- BINARY and VARBINARY columns can only be read as string
- connection failure to mysql 8 HOT 11
- how to connect to mysql via unix_socket?
- Support JSON data type
- Register custom decoder? HOT 2
- Inconsistent return value types HOT 2
- Add support for bit(1) reading
- values of UInt8 data types get converted to 125 HOT 8
- Cannot read query_one result as Bool HOT 4
- Shards Issue : install does not work HOT 6
- Release 0.8.0 missing HOT 1
- Missing block in decl_type *Blob ?
- Support for MariaDB? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crystal-mysql.