Skip to content

Fix test failures on Windows and Mac #117

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

Closed
2 of 3 tasks
krlmlr opened this issue Dec 30, 2018 · 16 comments · Fixed by #193
Closed
2 of 3 tasks

Fix test failures on Windows and Mac #117

krlmlr opened this issue Dec 30, 2018 · 16 comments · Fixed by #193
Labels
Milestone

Comments

@krlmlr
Copy link
Member

krlmlr commented Dec 30, 2018

#95 (comment) and following.

  • DBItest compatibility
  • macOS failures
  • Crashes on Win32
@krlmlr krlmlr added the bug label Dec 30, 2018
@jeroen
Copy link
Member

jeroen commented Dec 30, 2018

Perhaps the issue is not Windows/Mac specific but rather a bug or incompatibility with recent versions of mariadb-connector-c. Currently Windows builds with mariadb-connector-c 2.3.7 and macos builds with mariadb-connector-c 3.0.8.

@krlmlr
Copy link
Member Author

krlmlr commented Dec 31, 2018

Ran a debug build on Travis.

The brewed mysql instance has this:

$ mysql -D test -e "SHOW VARIABLES LIKE 'local_infile'"
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile  | OFF   |
+---------------+-------+

This causes an error with LOAD DATA LOCAL INFILE triggered by the "can read file from disk" test.

Skipping the test if detecting this condition in 7af3a2f.

@krlmlr
Copy link
Member Author

krlmlr commented Dec 31, 2018

Travis is green now.

@jeroen
Copy link
Member

jeroen commented Jan 2, 2019

OK great. Any luck with debugging Windows? I'd like to know if there is a problem with my driver builds or if this is just a bug elsewhere.

@krlmlr
Copy link
Member Author

krlmlr commented Jan 7, 2019

Couldn't replicate on Windows. As a last resort I could rdp into the worker, before doing that I'll double-check rtools version and compiler switches.

@krlmlr
Copy link
Member Author

krlmlr commented Jan 7, 2019

Saw a failure with the dev version of DBI and DBItest. Will investigate.

@krlmlr
Copy link
Member Author

krlmlr commented Jan 19, 2019

Steps to replicate on 32-bit Windows:

devtools::load_all()
DBItest::test_some("append_roundtrip_timestamp")

@krlmlr
Copy link
Member Author

krlmlr commented Jan 19, 2019

Dates with values of 2³¹ or larger are a problem:

library(DBI)
devtools::load_all()

local <- as.POSIXct(2^31, origin = "1970-01-01")
attr(local, "tzone") <- NULL
tbl_in <- data.frame(id = seq_along(local))
tbl_in$local <- local

con <- dbConnect(RMariaDB::MariaDB(), dbname = "test")

name <- "test"

dbRemoveTable(con, name, force = FALSE)
dbCreateTable(con, name, tbl_in)
dbAppendTable(con, name, tbl_in)

@jeroen
Copy link
Member

jeroen commented Jan 19, 2019

I think this is a case of the Year_2038_problem. A timestamp in R should be a double:

> typeof(Sys.time())
[1] "double"

This crash suggests you are using an int or time_t which overflows at 2³¹ on 32 bit systems, i.e. it cannot support dates beyond 2038-01-18 21:14:08 CST.

The solution is to avoid time_t and use a double.

@krlmlr
Copy link
Member Author

krlmlr commented Jan 26, 2019

Simplest reprex:

library(DBI)
devtools::load_all()

init_logging("VERB")

con <- dbConnect(RMariaDB::MariaDB(), dbname = "test")

local <- as.POSIXct(2^31, origin = "1970-01-01")
dbGetQuery(con, "SELECT ? AS a", params = list(local))

The reason is that gmtime() is called with a negative time_t value and returns a NULL pointer. Need to adopt an alternative implementation already used in RPostgres.

@krlmlr
Copy link
Member Author

krlmlr commented Feb 8, 2019

Simply avoiding the crash leads to test failures, unsurprisingly: https://ci.appveyor.com/project/r-dbi/rmariadb/builds/22218641#L797

@jeroen
Copy link
Member

jeroen commented Mar 5, 2019

@krlmlr
Copy link
Member Author

krlmlr commented Aug 25, 2020

We should pass POSIXlt to the C code instead of calling gmtime().

@krlmlr krlmlr added this to the 1.0.10 milestone Aug 25, 2020
@krlmlr
Copy link
Member Author

krlmlr commented Dec 27, 2020

r-dbi/RSQLite#333 uses Boost 1.75 for date/time functionality, maybe it's worth investigating.

krlmlr added a commit that referenced this issue Jan 3, 2021
- Timestamp roundtrip no longer fails on Windows i386 (#117).
@krlmlr
Copy link
Member Author

krlmlr commented Jan 3, 2021

The tests on Windows i386 no longer fail, maybe the new Connector/C? 🤷‍♂️

@github-actions
Copy link
Contributor

github-actions bot commented Jan 4, 2022

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants