Skip to content
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

R session crash on query #60

Closed
renkun-ken opened this issue Sep 26, 2017 · 29 comments
Closed

R session crash on query #60

renkun-ken opened this issue Sep 26, 2017 · 29 comments

Comments

@renkun-ken
Copy link
Contributor

renkun-ken commented Sep 26, 2017

I'm querying a database with the latest dev version of RMariaDB.

On Fedora 24, there's no problem, but on Ubuntu 16.04.3, a query of a full table will crash the session. Here's something I find maybe helpful:

> dbListFields(con, "ASHARECASHFLOW")
rsession: malloc.c:2394: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.

The table contains nearly 1M rows and 120 columns, most of them are DECIMAL. I tried RMySQL and crash again.

The following is the structure of the table:

Table: ASHARECASHFLOW
Columns:
OBJECT_ID	varchar(100) PK
S_INFO_WINDCODE	varchar(40)
WIND_CODE	varchar(40)
ANN_DT	varchar(8)
REPORT_PERIOD	varchar(8)
STATEMENT_TYPE	varchar(10)
CRNCY_CODE	varchar(10)
CASH_RECP_SG_AND_RS	decimal(20,4)
RECP_TAX_RENDS	decimal(20,4)
NET_INCR_DEP_COB	decimal(20,4)
NET_INCR_LOANS_CENTRAL_BANK	decimal(20,4)
NET_INCR_FUND_BORR_OFI	decimal(20,4)
CASH_RECP_PREM_ORIG_INCO	decimal(20,4)
NET_INCR_INSURED_DEP	decimal(20,4)
NET_CASH_RECEIVED_REINSU_BUS	decimal(20,4)
NET_INCR_DISP_TFA	decimal(20,4)
NET_INCR_INT_HANDLING_CHRG	decimal(20,4)
NET_INCR_DISP_FAAS	decimal(20,4)
NET_INCR_LOANS_OTHER_BANK	decimal(20,4)
NET_INCR_REPURCH_BUS_FUND	decimal(20,4)
OTHER_CASH_RECP_RAL_OPER_ACT	decimal(20,4)
STOT_CASH_INFLOWS_OPER_ACT	decimal(20,4)
CASH_PAY_GOODS_PURCH_SERV_REC	decimal(20,4)
CASH_PAY_BEH_EMPL	decimal(20,4)
PAY_ALL_TYP_TAX	decimal(20,4)
NET_INCR_CLIENTS_LOAN_ADV	decimal(20,4)
NET_INCR_DEP_CBOB	decimal(20,4)
CASH_PAY_CLAIMS_ORIG_INCO	decimal(20,4)
HANDLING_CHRG_PAID	decimal(20,4)
COMM_INSUR_PLCY_PAID	decimal(20,4)
OTHER_CASH_PAY_RAL_OPER_ACT	decimal(20,4)
STOT_CASH_OUTFLOWS_OPER_ACT	decimal(20,4)
NET_CASH_FLOWS_OPER_ACT	decimal(20,4)
CASH_RECP_DISP_WITHDRWL_INVEST	decimal(20,4)
CASH_RECP_RETURN_INVEST	decimal(20,4)
NET_CASH_RECP_DISP_FIOLTA	decimal(20,4)
NET_CASH_RECP_DISP_SOBU	decimal(20,4)
OTHER_CASH_RECP_RAL_INV_ACT	decimal(20,4)
STOT_CASH_INFLOWS_INV_ACT	decimal(20,4)
CASH_PAY_ACQ_CONST_FIOLTA	decimal(20,4)
CASH_PAID_INVEST	decimal(20,4)
NET_CASH_PAY_AQUIS_SOBU	decimal(20,4)
OTHER_CASH_PAY_RAL_INV_ACT	decimal(20,4)
NET_INCR_PLEDGE_LOAN	decimal(20,4)
STOT_CASH_OUTFLOWS_INV_ACT	decimal(20,4)
NET_CASH_FLOWS_INV_ACT	decimal(20,4)
CASH_RECP_CAP_CONTRIB	decimal(20,4)
INCL_CASH_REC_SAIMS	decimal(20,4)
CASH_RECP_BORROW	decimal(20,4)
PROC_ISSUE_BONDS	decimal(20,4)
OTHER_CASH_RECP_RAL_FNC_ACT	decimal(20,4)
STOT_CASH_INFLOWS_FNC_ACT	decimal(20,4)
CASH_PREPAY_AMT_BORR	decimal(20,4)
CASH_PAY_DIST_DPCP_INT_EXP	decimal(20,4)
INCL_DVD_PROFIT_PAID_SC_MS	decimal(20,4)
OTHER_CASH_PAY_RAL_FNC_ACT	decimal(20,4)
STOT_CASH_OUTFLOWS_FNC_ACT	decimal(20,4)
NET_CASH_FLOWS_FNC_ACT	decimal(20,4)
EFF_FX_FLU_CASH	decimal(20,4)
NET_INCR_CASH_CASH_EQU	decimal(20,4)
CASH_CASH_EQU_BEG_PERIOD	decimal(20,4)
CASH_CASH_EQU_END_PERIOD	decimal(20,4)
NET_PROFIT	decimal(20,4)
UNCONFIRMED_INVEST_LOSS	decimal(20,4)
PLUS_PROV_DEPR_ASSETS	decimal(20,4)
DEPR_FA_COGA_DPBA	decimal(20,4)
AMORT_INTANG_ASSETS	decimal(20,4)
AMORT_LT_DEFERRED_EXP	decimal(20,4)
DECR_DEFERRED_EXP	decimal(20,4)
INCR_ACC_EXP	decimal(20,4)
LOSS_DISP_FIOLTA	decimal(20,4)
LOSS_SCR_FA	decimal(20,4)
LOSS_FV_CHG	decimal(20,4)
FIN_EXP	decimal(20,4)
INVEST_LOSS	decimal(20,4)
DECR_DEFERRED_INC_TAX_ASSETS	decimal(20,4)
INCR_DEFERRED_INC_TAX_LIAB	decimal(20,4)
DECR_INVENTORIES	decimal(20,4)
DECR_OPER_PAYABLE	decimal(20,4)
INCR_OPER_PAYABLE	decimal(20,4)
OTHERS	decimal(20,4)
IM_NET_CASH_FLOWS_OPER_ACT	decimal(20,4)
CONV_DEBT_INTO_CAP	decimal(20,4)
CONV_CORP_BONDS_DUE_WITHIN_1Y	decimal(20,4)
FA_FNC_LEASES	decimal(20,4)
END_BAL_CASH	decimal(20,4)
LESS_BEG_BAL_CASH	decimal(20,4)
PLUS_END_BAL_CASH_EQU	decimal(20,4)
LESS_BEG_BAL_CASH_EQU	decimal(20,4)
IM_NET_INCR_CASH_CASH_EQU	decimal(20,4)
FREE_CASH_FLOW	decimal(20,4)
COMP_TYPE_CODE	varchar(2)
ACTUAL_ANN_DT	varchar(8)
SPE_BAL_CASH_INFLOWS_OPER	decimal(20,4)
TOT_BAL_CASH_INFLOWS_OPER	decimal(20,4)
SPE_BAL_CASH_OUTFLOWS_OPER	decimal(20,4)
TOT_BAL_CASH_OUTFLOWS_OPER	decimal(20,4)
TOT_BAL_NETCASH_OUTFLOWS_OPER	decimal(20,4)
SPE_BAL_CASH_INFLOWS_INV	decimal(20,4)
TOT_BAL_CASH_INFLOWS_INV	decimal(20,4)
SPE_BAL_CASH_OUTFLOWS_INV	decimal(20,4)
TOT_BAL_CASH_OUTFLOWS_INV	decimal(20,4)
TOT_BAL_NETCASH_OUTFLOWS_INV	decimal(20,4)
SPE_BAL_CASH_INFLOWS_FNC	decimal(20,4)
TOT_BAL_CASH_INFLOWS_FNC	decimal(20,4)
SPE_BAL_CASH_OUTFLOWS_FNC	decimal(20,4)
TOT_BAL_CASH_OUTFLOWS_FNC	decimal(20,4)
TOT_BAL_NETCASH_OUTFLOWS_FNC	decimal(20,4)
SPE_BAL_NETCASH_INC	decimal(20,4)
TOT_BAL_NETCASH_INC	decimal(20,4)
SPE_BAL_NETCASH_EQU_UNDIR	decimal(20,4)
TOT_BAL_NETCASH_EQU_UNDIR	decimal(20,4)
SPE_BAL_NETCASH_INC_UNDIR	decimal(20,4)
TOT_BAL_NETCASH_INC_UNDIR	decimal(20,4)
S_INFO_COMPCODE	varchar(10)
OPDATE	datetime
OPMODE	varchar(1)

My session info:

R version 3.4.1 (2017-06-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.3 LTS

Matrix products: default
BLAS: /usr/lib/openblas-base/libblas.so.3
LAPACK: /usr/lib/libopenblasp-r0.2.18.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] DBI_0.7-12

loaded via a namespace (and not attached):
[1] bit_1.1-12      compiler_3.4.1  hms_0.3         tools_3.4.1     RMariaDB_0.11-7 yaml_2.1.14     Rcpp_0.12.12    bit64_0.9-7   
@renkun-ken
Copy link
Contributor Author

I tried to query another table with 400,000 rows and 167 columns of the following structure without any problem:

Table: ASHAREBALANCESHEET
Columns:
OBJECT_ID	varchar(100) PK
S_INFO_WINDCODE	varchar(40)
WIND_CODE	varchar(40)
ANN_DT	varchar(8)
REPORT_PERIOD	varchar(8)
STATEMENT_TYPE	varchar(10)
CRNCY_CODE	varchar(10)
MONETARY_CAP	decimal(20,4)
TRADABLE_FIN_ASSETS	decimal(20,4)
NOTES_RCV	decimal(20,4)
ACCT_RCV	decimal(20,4)
OTH_RCV	decimal(20,4)
PREPAY	decimal(20,4)
DVD_RCV	decimal(20,4)
INT_RCV	decimal(20,4)
INVENTORIES	decimal(20,4)
CONSUMPTIVE_BIO_ASSETS	decimal(20,4)
DEFERRED_EXP	decimal(20,4)
NON_CUR_ASSETS_DUE_WITHIN_1Y	decimal(20,4)
SETTLE_RSRV	decimal(20,4)
LOANS_TO_OTH_BANKS	decimal(20,4)
PREM_RCV	decimal(20,4)
RCV_FROM_REINSURER	decimal(20,4)
RCV_FROM_CEDED_INSUR_CONT_RSRV	decimal(20,4)
RED_MONETARY_CAP_FOR_SALE	decimal(20,4)
OTH_CUR_ASSETS	decimal(20,4)
TOT_CUR_ASSETS	decimal(20,4)
FIN_ASSETS_AVAIL_FOR_SALE	decimal(20,4)
HELD_TO_MTY_INVEST	decimal(20,4)
LONG_TERM_EQY_INVEST	decimal(20,4)
INVEST_REAL_ESTATE	decimal(20,4)
TIME_DEPOSITS	decimal(20,4)
OTH_ASSETS	decimal(20,4)
LONG_TERM_REC	decimal(20,4)
FIX_ASSETS	decimal(20,4)
CONST_IN_PROG	decimal(20,4)
PROJ_MATL	decimal(20,4)
FIX_ASSETS_DISP	decimal(20,4)
PRODUCTIVE_BIO_ASSETS	decimal(20,4)
OIL_AND_NATURAL_GAS_ASSETS	decimal(20,4)
INTANG_ASSETS	decimal(20,4)
R_AND_D_COSTS	decimal(20,4)
GOODWILL	decimal(20,4)
LONG_TERM_DEFERRED_EXP	decimal(20,4)
DEFERRED_TAX_ASSETS	decimal(20,4)
LOANS_AND_ADV_GRANTED	decimal(20,4)
OTH_NON_CUR_ASSETS	decimal(20,4)
TOT_NON_CUR_ASSETS	decimal(20,4)
CASH_DEPOSITS_CENTRAL_BANK	decimal(20,4)
ASSET_DEP_OTH_BANKS_FIN_INST	decimal(20,4)
PRECIOUS_METALS	decimal(20,4)
DERIVATIVE_FIN_ASSETS	decimal(20,4)
AGENCY_BUS_ASSETS	decimal(20,4)
SUBR_REC	decimal(20,4)
RCV_CEDED_UNEARNED_PREM_RSRV	decimal(20,4)
RCV_CEDED_CLAIM_RSRV	decimal(20,4)
RCV_CEDED_LIFE_INSUR_RSRV	decimal(20,4)
RCV_CEDED_LT_HEALTH_INSUR_RSRV	decimal(20,4)
MRGN_PAID	decimal(20,4)
INSURED_PLEDGE_LOAN	decimal(20,4)
CAP_MRGN_PAID	decimal(20,4)
INDEPENDENT_ACCT_ASSETS	decimal(20,4)
CLIENTS_CAP_DEPOSIT	decimal(20,4)
CLIENTS_RSRV_SETTLE	decimal(20,4)
INCL_SEAT_FEES_EXCHANGE	decimal(20,4)
RCV_INVEST	decimal(20,4)
TOT_ASSETS	decimal(20,4)
ST_BORROW	decimal(20,4)
BORROW_CENTRAL_BANK	decimal(20,4)
DEPOSIT_RECEIVED_IB_DEPOSITS	decimal(20,4)
LOANS_OTH_BANKS	decimal(20,4)
TRADABLE_FIN_LIAB	decimal(20,4)
NOTES_PAYABLE	decimal(20,4)
ACCT_PAYABLE	decimal(20,4)
ADV_FROM_CUST	decimal(20,4)
FUND_SALES_FIN_ASSETS_RP	decimal(20,4)
HANDLING_CHARGES_COMM_PAYABLE	decimal(20,4)
EMPL_BEN_PAYABLE	decimal(20,4)
TAXES_SURCHARGES_PAYABLE	decimal(20,4)
INT_PAYABLE	decimal(20,4)
DVD_PAYABLE	decimal(20,4)
OTH_PAYABLE	decimal(20,4)
ACC_EXP	decimal(20,4)
DEFERRED_INC	decimal(20,4)
ST_BONDS_PAYABLE	decimal(20,4)
PAYABLE_TO_REINSURER	decimal(20,4)
RSRV_INSUR_CONT	decimal(20,4)
ACTING_TRADING_SEC	decimal(20,4)
ACTING_UW_SEC	decimal(20,4)
NON_CUR_LIAB_DUE_WITHIN_1Y	decimal(20,4)
OTH_CUR_LIAB	decimal(20,4)
TOT_CUR_LIAB	decimal(20,4)
LT_BORROW	decimal(20,4)
BONDS_PAYABLE	decimal(20,4)
LT_PAYABLE	decimal(20,4)
SPECIFIC_ITEM_PAYABLE	decimal(20,4)
PROVISIONS	decimal(20,4)
DEFERRED_TAX_LIAB	decimal(20,4)
DEFERRED_INC_NON_CUR_LIAB	decimal(20,4)
OTH_NON_CUR_LIAB	decimal(20,4)
TOT_NON_CUR_LIAB	decimal(20,4)
LIAB_DEP_OTH_BANKS_FIN_INST	decimal(20,4)
DERIVATIVE_FIN_LIAB	decimal(20,4)
CUST_BANK_DEP	decimal(20,4)
AGENCY_BUS_LIAB	decimal(20,4)
OTH_LIAB	decimal(20,4)
PREM_RECEIVED_ADV	decimal(20,4)
DEPOSIT_RECEIVED	decimal(20,4)
INSURED_DEPOSIT_INVEST	decimal(20,4)
UNEARNED_PREM_RSRV	decimal(20,4)
OUT_LOSS_RSRV	decimal(20,4)
LIFE_INSUR_RSRV	decimal(20,4)
LT_HEALTH_INSUR_V	decimal(20,4)
INDEPENDENT_ACCT_LIAB	decimal(20,4)
INCL_PLEDGE_LOAN	decimal(20,4)
CLAIMS_PAYABLE	decimal(20,4)
DVD_PAYABLE_INSURED	decimal(20,4)
TOT_LIAB	decimal(20,4)
CAP_STK	decimal(20,4)
CAP_RSRV	decimal(20,4)
SPECIAL_RSRV	decimal(20,4)
SURPLUS_RSRV	decimal(20,4)
UNDISTRIBUTED_PROFIT	decimal(20,4)
LESS_TSY_STK	decimal(20,4)
PROV_NOM_RISKS	decimal(20,4)
CNVD_DIFF_FOREIGN_CURR_STAT	decimal(20,4)
UNCONFIRMED_INVEST_LOSS	decimal(20,4)
MINORITY_INT	decimal(20,4)
TOT_SHRHLDR_EQY_EXCL_MIN_INT	decimal(20,4)
TOT_SHRHLDR_EQY_INCL_MIN_INT	decimal(20,4)
TOT_LIAB_SHRHLDR_EQY	decimal(20,4)
COMP_TYPE_CODE	varchar(2)
ACTUAL_ANN_DT	varchar(8)
SPE_CUR_ASSETS_DIFF	decimal(20,4)
TOT_CUR_ASSETS_DIFF	decimal(20,4)
SPE_NON_CUR_ASSETS_DIFF	decimal(20,4)
TOT_NON_CUR_ASSETS_DIFF	decimal(20,4)
SPE_BAL_ASSETS_DIFF	decimal(20,4)
TOT_BAL_ASSETS_DIFF	decimal(20,4)
SPE_CUR_LIAB_DIFF	decimal(20,4)
TOT_CUR_LIAB_DIFF	decimal(20,4)
SPE_NON_CUR_LIAB_DIFF	decimal(20,4)
TOT_NON_CUR_LIAB_DIFF	decimal(20,4)
SPE_BAL_LIAB_DIFF	decimal(20,4)
TOT_BAL_LIAB_DIFF	decimal(20,4)
SPE_BAL_SHRHLDR_EQY_DIFF	decimal(20,4)
TOT_BAL_SHRHLDR_EQY_DIFF	decimal(20,4)
SPE_BAL_LIAB_EQY_DIFF	decimal(20,4)
TOT_BAL_LIAB_EQY_DIFF	decimal(20,4)
LT_PAYROLL_PAYABLE	decimal(20,4)
OTHER_COMP_INCOME	decimal(20,4)
OTHER_EQUITY_TOOLS	decimal(20,4)
OTHER_EQUITY_TOOLS_P_SHR	decimal(20,4)
LENDING_FUNDS	decimal(20,4)
ACCOUNTS_RECEIVABLE	decimal(20,4)
ST_FINANCING_PAYABLE	decimal(20,4)
PAYABLES	decimal(20,4)
S_INFO_COMPCODE	varchar(10)
TOT_SHR	decimal(20,4)
HFS_ASSETS	decimal(20,4)
HFS_SALES	decimal(20,4)
OPDATE	datetime
OPMODE	varchar(1)

@renkun-ken
Copy link
Contributor Author

Not sure if this has anything to do with r-dbi/RMySQL#204.

@renkun-ken
Copy link
Contributor Author

I tried with yet another table with more than 1M rows and 95 columns of the following structure without any problem:

Table: ASHAREINCOME
Columns:
OBJECT_ID	varchar(100) PK
S_INFO_WINDCODE	varchar(40)
WIND_CODE	varchar(40)
ANN_DT	varchar(8)
REPORT_PERIOD	varchar(8)
STATEMENT_TYPE	varchar(10)
CRNCY_CODE	varchar(10)
TOT_OPER_REV	decimal(20,4)
OPER_REV	decimal(20,4)
INT_INC	decimal(20,4)
NET_INT_INC	decimal(20,4)
INSUR_PREM_UNEARNED	decimal(20,4)
HANDLING_CHRG_COMM_INC	decimal(20,4)
NET_HANDLING_CHRG_COMM_INC	decimal(20,4)
NET_INC_OTHER_OPS	decimal(20,4)
PLUS_NET_INC_OTHER_BUS	decimal(20,4)
PREM_INC	decimal(20,4)
LESS_CEDED_OUT_PREM	decimal(20,4)
CHG_UNEARNED_PREM_RES	decimal(20,4)
INCL_REINSURANCE_PREM_INC	decimal(20,4)
NET_INC_SEC_TRADING_BROK_BUS	decimal(20,4)
NET_INC_SEC_UW_BUS	decimal(20,4)
NET_INC_EC_ASSET_MGMT_BUS	decimal(20,4)
OTHER_BUS_INC	decimal(20,4)
PLUS_NET_GAIN_CHG_FV	decimal(20,4)
PLUS_NET_INVEST_INC	decimal(20,4)
INCL_INC_INVEST_ASSOC_JV_ENTP	decimal(20,4)
PLUS_NET_GAIN_FX_TRANS	decimal(20,4)
TOT_OPER_COST	decimal(20,4)
LESS_OPER_COST	decimal(20,4)
LESS_INT_EXP	decimal(20,4)
LESS_HANDLING_CHRG_COMM_EXP	decimal(20,4)
LESS_TAXES_SURCHARGES_OPS	decimal(20,4)
LESS_SELLING_DIST_EXP	decimal(20,4)
LESS_GERL_ADMIN_EXP	decimal(20,4)
LESS_FIN_EXP	decimal(20,4)
LESS_IMPAIR_LOSS_ASSETS	decimal(20,4)
PREPAY_SURR	decimal(20,4)
TOT_CLAIM_EXP	decimal(20,4)
CHG_INSUR_CONT_RSRV	decimal(20,4)
DVD_EXP_INSURED	decimal(20,4)
REINSURANCE_EXP	decimal(20,4)
OPER_EXP	decimal(20,4)
LESS_CLAIM_RECB_REINSURER	decimal(20,4)
LESS_INS_RSRV_RECB_REINSURER	decimal(20,4)
LESS_EXP_RECB_REINSURER	decimal(20,4)
OTHER_BUS_COST	decimal(20,4)
OPER_PROFIT	decimal(20,4)
PLUS_NON_OPER_REV	decimal(20,4)
LESS_NON_OPER_EXP	decimal(20,4)
IL_NET_LOSS_DISP_NONCUR_ASSET	decimal(20,4)
TOT_PROFIT	decimal(20,4)
INC_TAX	decimal(20,4)
UNCONFIRMED_INVEST_LOSS	decimal(20,4)
NET_PROFIT_INCL_MIN_INT_INC	decimal(20,4)
NET_PROFIT_EXCL_MIN_INT_INC	decimal(20,4)
MINORITY_INT_INC	decimal(20,4)
OTHER_COMPREH_INC	decimal(20,4)
TOT_COMPREH_INC	decimal(20,4)
TOT_COMPREH_INC_PARENT_COMP	decimal(20,4)
TOT_COMPREH_INC_MIN_SHRHLDR	decimal(20,4)
EBIT	decimal(20,4)
EBITDA	decimal(20,4)
NET_PROFIT_AFTER_DED_NR_LP	decimal(20,4)
NET_PROFIT_UNDER_INTL_ACC_STA	decimal(20,4)
COMP_TYPE_CODE	varchar(2)
S_FA_EPS_BASIC	decimal(20,4)
S_FA_EPS_DILUTED	decimal(20,4)
ACTUAL_ANN_DT	varchar(8)
INSURANCE_EXPENSE	decimal(20,4)
SPE_BAL_OPER_PROFIT	decimal(20,4)
TOT_BAL_OPER_PROFIT	decimal(20,4)
SPE_BAL_TOT_PROFIT	decimal(20,4)
TOT_BAL_TOT_PROFIT	decimal(20,4)
SPE_BAL_NET_PROFIT	decimal(20,4)
TOT_BAL_NET_PROFIT	decimal(20,4)
UNDISTRIBUTED_PROFIT	decimal(20,4)
ADJLOSSGAIN_PREVYEAR	decimal(20,4)
TRANSFER_FROM_SURPLUSRESERVE	decimal(20,4)
TRANSFER_FROM_HOUSINGIMPREST	decimal(20,4)
TRANSFER_FROM_OTHERS	decimal(20,4)
DISTRIBUTABLE_PROFIT	decimal(20,4)
WITHDR_LEGALSURPLUS	decimal(20,4)
WITHDR_LEGALPUBWELFUNDS	decimal(20,4)
WORKERS_WELFARE	decimal(20,4)
WITHDR_BUZEXPWELFARE	decimal(20,4)
WITHDR_RESERVEFUND	decimal(20,4)
DISTRIBUTABLE_PROFIT_SHRHDER	decimal(20,4)
PRFSHARE_DVD_PAYABLE	decimal(20,4)
WITHDR_OTHERSURPRESERVE	decimal(20,4)
COMSHARE_DVD_PAYABLE	decimal(20,4)
CAPITALIZED_COMSTOCK_DIV	decimal(20,4)
S_INFO_COMPCODE	varchar(10)
OPDATE	datetime
OPMODE	varchar(1)

@krlmlr
Copy link
Member

krlmlr commented Sep 26, 2017

Thanks. What driver are you building against? Can you please show the complete output of devtools::install_github("rstats-db/RMariaDB"), and also your devtools::session_info()?

@renkun-ken
Copy link
Contributor Author

> devtools::install_github("rstats-db/RMariaDB", force = TRUE)
Downloading GitHub repo rstats-db/RMariaDB@master
from URL https://api.github.com/repos/rstats-db/RMariaDB/zipball/master
Installing RMariaDB
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/tmp/RtmpzDbHL5/devtools1e063793422/rstats-db-RMariaDB-a728207' --library='/home/renkun/R/x86_64-pc-linux-gnu-library/3.4' --install-tests 

* installing *source* package ‘RMariaDB’ ...
Found mysql_config cflags and libs!
Using PKG_CFLAGS=-I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized
Using PKG_LIBS=-L/usr/lib/x86_64-linux-gnu -lmariadb
** libs
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c MariaBinding.cpp -o MariaBinding.o
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c MariaConnection.cpp -o MariaConnection.o
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c MariaResult.cpp -o MariaResult.o
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c MariaRow.cpp -o MariaRow.o
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c MariaTypes.cpp -o MariaTypes.o
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c MariaUtils.cpp -o MariaUtils.o
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c RcppExports.cpp -o RcppExports.o
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c connection.cpp -o connection.o
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c driver.cpp -o driver.o
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c result.cpp -o result.o
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RMariaDB.so MariaBinding.o MariaConnection.o MariaResult.o MariaRow.o MariaTypes.o MariaUtils.o RcppExports.o connection.o driver.o result.o -L/usr/lib/x86_64-linux-gnu -lmariadb -L/usr/lib/R/lib -lR
installing to /home/renkun/R/x86_64-pc-linux-gnu-library/3.4/RMariaDB/libs
** R
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (RMariaDB)
> devtools::session_info()
Session info ------------------------------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.4.1 (2017-06-30)
 system   x86_64, linux-gnu           
 ui       RStudio (1.1.374)           
 language en_US                       
 collate  en_US.UTF-8                 
 tz       PRC                         
 date     2017-09-26                  

Packages ----------------------------------------------------------------------------------------------------------------------------------------------
 package   * version date       source                             
 base      * 3.4.1   2017-07-08 local                              
 bit         1.1-12  2014-04-09 CRAN (R 3.4.0)                     
 bit64       0.9-7   2017-05-08 CRAN (R 3.4.0)                     
 compiler    3.4.1   2017-07-08 local                              
 curl        2.8.1   2017-07-21 CRAN (R 3.4.1)                     
 datasets  * 3.4.1   2017-07-08 local                              
 DBI       * 0.7-12  2017-08-16 Github (rstats-db/DBI@f8c97f2)     
 devtools    1.13.3  2017-08-02 CRAN (R 3.4.1)                     
 digest      0.6.12  2017-01-27 CRAN (R 3.4.0)                     
 git2r       0.19.0  2017-07-19 CRAN (R 3.4.1)                     
 graphics  * 3.4.1   2017-07-08 local                              
 grDevices * 3.4.1   2017-07-08 local                              
 hms         0.3     2016-11-22 cran (@0.3)                        
 httr        1.3.1   2017-08-20 CRAN (R 3.4.1)                     
 memoise     1.1.0   2017-04-21 CRAN (R 3.4.0)                     
 methods   * 3.4.1   2017-07-08 local                              
 R6          2.2.2   2017-06-17 CRAN (R 3.4.0)                     
 Rcpp        0.12.12 2017-07-15 cran (@0.12.12)                    
 RMariaDB    0.11-7  2017-09-26 Github (rstats-db/RMariaDB@a728207)
 stats     * 3.4.1   2017-07-08 local                              
 tools       3.4.1   2017-07-08 local                              
 utils     * 3.4.1   2017-07-08 local                              
 withr       2.0.0   2017-07-28 CRAN (R 3.4.1)                     
 yaml        2.1.14  2016-11-12 CRAN (R 3.4.0)             

@krlmlr
Copy link
Member

krlmlr commented Sep 26, 2017

Thanks. What does mysql_config print on your system?

@renkun-ken
Copy link
Contributor Author

The database is hosted on a Fedora 24 server. Here's the output of mysql_config on that server:

Usage: /usr/bin/mysql_config-64 [OPTIONS]
Options:
        --cflags         [-I/usr/include/mysql -m64 -fabi-version=2 -fno-omit-frame-pointer]
        --cxxflags       [-I/usr/include/mysql -fexceptions -m64 -fabi-version=2 -fno-omit-frame-pointer -std=gnu++03]
        --include        [-I/usr/include/mysql]
        --libs           [-L/usr/lib64/mysql -lmysqlclient -lpthread -lm -lrt -ldl]
        --libs_r         [-L/usr/lib64/mysql -lmysqlclient -lpthread -lm -lrt -ldl]
        --plugindir      [/usr/lib64/mysql/plugin]
        --socket         [/var/lib/mysql/mysql.sock]
        --port           [0]
        --version        [5.7.15]
        --libmysqld-libs [-L/usr/lib64/mysql -lmysqld -lpthread -lm -lrt -lcrypt -ldl -laio -lnuma]
        --variable=VAR   VAR is one of:
                pkgincludedir [/usr/include/mysql]
                pkglibdir     [/usr/lib64/mysql]
                plugindir     [/usr/lib64/mysql/plugin]

@renkun-ken
Copy link
Contributor Author

On my client machine, there's a MariaDB server, but there's no mysql_config but mariadb_config:

Copyright 2011 Monty Program AB
Get compiler flags for using the MariaDB client library.
Usage: mariadb_config [OPTIONS]
  --cflags        [-I/usr/include/mariadb -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2  -Wunused -Wno-uninitialized]
  --include       [-I/usr/include/mariadb]
  --libs          [-L/usr/lib/x86_64-linux-gnu -lmariadb]
  --libs_r        [-L/usr/lib/x86_64-linux-gnu -lmariadb]
  --version       [5.5.0]
  --socket        [/tmp/mysql.sock]
  --port          [3306]

@krlmlr
Copy link
Member

krlmlr commented Sep 26, 2017

Thanks. I was confused by the devtools::install_github() output, should be better now (f3ffe86).

IIUC, your client (Ubuntu + libmariadbclient-dev) crashes, while the same code on the server (Fedora 24 + mysql-devel) works. A few things to try:

  • On the client, can you install libmysqlclient-dev and then reinstall RMariaDB and retry? Note that this will uninstall libmariadbclient-dev. This is just to make sure that this is a connector problem, and not a server problem.
  • If it doesn't crash anymore, can you try compiling Connector/C from source, and reinstall RMariaDB so that the version compiled from source is used? This is important for filing an upstream bug, if necessary.
  • Can you share code that creates a table that would crash on your server? This would allow me to test locally.

@renkun-ken
Copy link
Contributor Author

I removed libmariadbclient-dev and installed libmysqlclient-dev and reinstalled RMariaDB with the following output and still crashes:

Downloading GitHub repo rstats-db/RMariaDB@master
from URL https://api.github.com/repos/rstats-db/RMariaDB/zipball/master
Installing RMariaDB
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/tmp/RtmpRV75TG/devtools4e5e27687f67/rstats-db-RMariaDB-f3ffe86' --library='/home/renkun/R/x86_64-pc-linux-gnu-library/3.4' --install-tests 

* installing *source* package ‘RMariaDB’ ...
Using mysql_config
Found mysql_config/mariadb_config cflags and libs!
Using PKG_CFLAGS=-I/usr/include/mysql 
Using PKG_LIBS=-L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -ldl
** libs
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql  -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c MariaBinding.cpp -o MariaBinding.o
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql  -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c MariaConnection.cpp -o MariaConnection.o
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql  -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c MariaResult.cpp -o MariaResult.o
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql  -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c MariaRow.cpp -o MariaRow.o
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql  -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c MariaTypes.cpp -o MariaTypes.o
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql  -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c MariaUtils.cpp -o MariaUtils.o
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql  -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c RcppExports.cpp -o RcppExports.o
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql  -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c connection.cpp -o connection.o
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql  -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c driver.cpp -o driver.o
g++  -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql  -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/BH/include" -I"/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/plogr/include"    -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c result.cpp -o result.o
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RMariaDB.so MariaBinding.o MariaConnection.o MariaResult.o MariaRow.o MariaTypes.o MariaUtils.o RcppExports.o connection.o driver.o result.o -L/usr/lib/x86_64-linux-gnu -lmysqlclient -lpthread -lz -lm -lrt -ldl -L/usr/lib/R/lib -lR
installing to /home/renkun/R/x86_64-pc-linux-gnu-library/3.4/RMariaDB/libs
** R
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (RMariaDB)

@renkun-ken
Copy link
Contributor Author

The following is the create statement of the table:

CREATE TABLE `ASHARECASHFLOW` (
  `OBJECT_ID` varchar(100) NOT NULL COMMENT '对象ID',
  `S_INFO_WINDCODE` varchar(40) DEFAULT NULL COMMENT 'Wind代码',
  `WIND_CODE` varchar(40) DEFAULT NULL COMMENT 'Wind代码',
  `ANN_DT` varchar(8) DEFAULT NULL COMMENT '公告日期',
  `REPORT_PERIOD` varchar(8) DEFAULT NULL COMMENT '报告期',
  `STATEMENT_TYPE` varchar(10) DEFAULT NULL COMMENT '报表类型',
  `CRNCY_CODE` varchar(10) DEFAULT NULL COMMENT '货币代码',
  `CASH_RECP_SG_AND_RS` decimal(20,4) DEFAULT NULL COMMENT '销售商品、提供劳务收到的现金',
  `RECP_TAX_RENDS` decimal(20,4) DEFAULT NULL COMMENT '收到的税费返还',
  `NET_INCR_DEP_COB` decimal(20,4) DEFAULT NULL COMMENT '客户存款和同业存放款项净增加额',
  `NET_INCR_LOANS_CENTRAL_BANK` decimal(20,4) DEFAULT NULL COMMENT '向中央银行借款净增加额',
  `NET_INCR_FUND_BORR_OFI` decimal(20,4) DEFAULT NULL COMMENT '向其他金融机构拆入资金净增加额',
  `CASH_RECP_PREM_ORIG_INCO` decimal(20,4) DEFAULT NULL COMMENT '收到原保险合同保费取得的现金',
  `NET_INCR_INSURED_DEP` decimal(20,4) DEFAULT NULL COMMENT '保户储金净增加额',
  `NET_CASH_RECEIVED_REINSU_BUS` decimal(20,4) DEFAULT NULL COMMENT '收到再保业务现金净额',
  `NET_INCR_DISP_TFA` decimal(20,4) DEFAULT NULL COMMENT '处置交易性金融资产净增加额',
  `NET_INCR_INT_HANDLING_CHRG` decimal(20,4) DEFAULT NULL COMMENT '收取利息和手续费净增加额',
  `NET_INCR_DISP_FAAS` decimal(20,4) DEFAULT NULL COMMENT '处置可供出售金融资产净增加额',
  `NET_INCR_LOANS_OTHER_BANK` decimal(20,4) DEFAULT NULL COMMENT '拆入资金净增加额',
  `NET_INCR_REPURCH_BUS_FUND` decimal(20,4) DEFAULT NULL COMMENT '回购业务资金净增加额',
  `OTHER_CASH_RECP_RAL_OPER_ACT` decimal(20,4) DEFAULT NULL COMMENT '收到其他与经营活动有关的现金',
  `STOT_CASH_INFLOWS_OPER_ACT` decimal(20,4) DEFAULT NULL COMMENT '经营活动现金流入小计',
  `CASH_PAY_GOODS_PURCH_SERV_REC` decimal(20,4) DEFAULT NULL COMMENT '购买商品、接受劳务支付的现金',
  `CASH_PAY_BEH_EMPL` decimal(20,4) DEFAULT NULL COMMENT '支付给职工以及为职工支付的现金',
  `PAY_ALL_TYP_TAX` decimal(20,4) DEFAULT NULL COMMENT '支付的各项税费',
  `NET_INCR_CLIENTS_LOAN_ADV` decimal(20,4) DEFAULT NULL COMMENT '客户贷款及垫款净增加额',
  `NET_INCR_DEP_CBOB` decimal(20,4) DEFAULT NULL COMMENT '存放央行和同业款项净增加额',
  `CASH_PAY_CLAIMS_ORIG_INCO` decimal(20,4) DEFAULT NULL COMMENT '支付原保险合同赔付款项的现金',
  `HANDLING_CHRG_PAID` decimal(20,4) DEFAULT NULL COMMENT '支付手续费的现金',
  `COMM_INSUR_PLCY_PAID` decimal(20,4) DEFAULT NULL COMMENT '支付保单红利的现金',
  `OTHER_CASH_PAY_RAL_OPER_ACT` decimal(20,4) DEFAULT NULL COMMENT '支付其他与经营活动有关的现金',
  `STOT_CASH_OUTFLOWS_OPER_ACT` decimal(20,4) DEFAULT NULL COMMENT '经营活动现金流出小计',
  `NET_CASH_FLOWS_OPER_ACT` decimal(20,4) DEFAULT NULL COMMENT '经营活动产生的现金流量净额',
  `CASH_RECP_DISP_WITHDRWL_INVEST` decimal(20,4) DEFAULT NULL COMMENT '收回投资收到的现金',
  `CASH_RECP_RETURN_INVEST` decimal(20,4) DEFAULT NULL COMMENT '取得投资收益收到的现金',
  `NET_CASH_RECP_DISP_FIOLTA` decimal(20,4) DEFAULT NULL COMMENT '处置固定资产、无形资产和其他长期资产收回的现金净额',
  `NET_CASH_RECP_DISP_SOBU` decimal(20,4) DEFAULT NULL COMMENT '处置子公司及其他营业单位收到的现金净额',
  `OTHER_CASH_RECP_RAL_INV_ACT` decimal(20,4) DEFAULT NULL COMMENT '收到其他与投资活动有关的现金',
  `STOT_CASH_INFLOWS_INV_ACT` decimal(20,4) DEFAULT NULL COMMENT '投资活动现金流入小计',
  `CASH_PAY_ACQ_CONST_FIOLTA` decimal(20,4) DEFAULT NULL COMMENT '购建固定资产、无形资产和其他长期资产支付的现金',
  `CASH_PAID_INVEST` decimal(20,4) DEFAULT NULL COMMENT '投资支付的现金',
  `NET_CASH_PAY_AQUIS_SOBU` decimal(20,4) DEFAULT NULL COMMENT '取得子公司及其他营业单位支付的现金净额',
  `OTHER_CASH_PAY_RAL_INV_ACT` decimal(20,4) DEFAULT NULL COMMENT '支付其他与投资活动有关的现金',
  `NET_INCR_PLEDGE_LOAN` decimal(20,4) DEFAULT NULL COMMENT '质押贷款净增加额',
  `STOT_CASH_OUTFLOWS_INV_ACT` decimal(20,4) DEFAULT NULL COMMENT '投资活动现金流出小计',
  `NET_CASH_FLOWS_INV_ACT` decimal(20,4) DEFAULT NULL COMMENT '投资活动产生的现金流量净额',
  `CASH_RECP_CAP_CONTRIB` decimal(20,4) DEFAULT NULL COMMENT '吸收投资收到的现金',
  `INCL_CASH_REC_SAIMS` decimal(20,4) DEFAULT NULL COMMENT '其中:子公司吸收少数股东投资收到的现金',
  `CASH_RECP_BORROW` decimal(20,4) DEFAULT NULL COMMENT '取得借款收到的现金',
  `PROC_ISSUE_BONDS` decimal(20,4) DEFAULT NULL COMMENT '发行债券收到的现金',
  `OTHER_CASH_RECP_RAL_FNC_ACT` decimal(20,4) DEFAULT NULL COMMENT '收到其他与筹资活动有关的现金',
  `STOT_CASH_INFLOWS_FNC_ACT` decimal(20,4) DEFAULT NULL COMMENT '筹资活动现金流入小计',
  `CASH_PREPAY_AMT_BORR` decimal(20,4) DEFAULT NULL COMMENT '偿还债务支付的现金',
  `CASH_PAY_DIST_DPCP_INT_EXP` decimal(20,4) DEFAULT NULL COMMENT '分配股利、利润或偿付利息支付的现金',
  `INCL_DVD_PROFIT_PAID_SC_MS` decimal(20,4) DEFAULT NULL COMMENT '其中:子公司支付给少数股东的股利、利润',
  `OTHER_CASH_PAY_RAL_FNC_ACT` decimal(20,4) DEFAULT NULL COMMENT '支付其他与筹资活动有关的现金',
  `STOT_CASH_OUTFLOWS_FNC_ACT` decimal(20,4) DEFAULT NULL COMMENT '筹资活动现金流出小计',
  `NET_CASH_FLOWS_FNC_ACT` decimal(20,4) DEFAULT NULL COMMENT '筹资活动产生的现金流量净额',
  `EFF_FX_FLU_CASH` decimal(20,4) DEFAULT NULL COMMENT '汇率变动对现金的影响',
  `NET_INCR_CASH_CASH_EQU` decimal(20,4) DEFAULT NULL COMMENT '现金及现金等价物净增加额',
  `CASH_CASH_EQU_BEG_PERIOD` decimal(20,4) DEFAULT NULL COMMENT '期初现金及现金等价物余额',
  `CASH_CASH_EQU_END_PERIOD` decimal(20,4) DEFAULT NULL COMMENT '期末现金及现金等价物余额',
  `NET_PROFIT` decimal(20,4) DEFAULT NULL COMMENT '净利润',
  `UNCONFIRMED_INVEST_LOSS` decimal(20,4) DEFAULT NULL COMMENT '未确认投资损失',
  `PLUS_PROV_DEPR_ASSETS` decimal(20,4) DEFAULT NULL COMMENT '加:资产减值准备',
  `DEPR_FA_COGA_DPBA` decimal(20,4) DEFAULT NULL COMMENT '固定资产折旧、油气资产折耗、生产性生物资产折旧',
  `AMORT_INTANG_ASSETS` decimal(20,4) DEFAULT NULL COMMENT '无形资产摊销',
  `AMORT_LT_DEFERRED_EXP` decimal(20,4) DEFAULT NULL COMMENT '长期待摊费用摊销',
  `DECR_DEFERRED_EXP` decimal(20,4) DEFAULT NULL COMMENT '待摊费用减少',
  `INCR_ACC_EXP` decimal(20,4) DEFAULT NULL COMMENT '预提费用增加',
  `LOSS_DISP_FIOLTA` decimal(20,4) DEFAULT NULL COMMENT '处置固定、无形资产和其他长期资产的损失',
  `LOSS_SCR_FA` decimal(20,4) DEFAULT NULL COMMENT '固定资产报废损失',
  `LOSS_FV_CHG` decimal(20,4) DEFAULT NULL COMMENT '公允价值变动损失',
  `FIN_EXP` decimal(20,4) DEFAULT NULL COMMENT '财务费用',
  `INVEST_LOSS` decimal(20,4) DEFAULT NULL COMMENT '投资损失',
  `DECR_DEFERRED_INC_TAX_ASSETS` decimal(20,4) DEFAULT NULL COMMENT '递延所得税资产减少',
  `INCR_DEFERRED_INC_TAX_LIAB` decimal(20,4) DEFAULT NULL COMMENT '递延所得税负债增加',
  `DECR_INVENTORIES` decimal(20,4) DEFAULT NULL COMMENT '存货的减少',
  `DECR_OPER_PAYABLE` decimal(20,4) DEFAULT NULL COMMENT '经营性应收项目的减少',
  `INCR_OPER_PAYABLE` decimal(20,4) DEFAULT NULL COMMENT '经营性应付项目的增加',
  `OTHERS` decimal(20,4) DEFAULT NULL COMMENT '其他',
  `IM_NET_CASH_FLOWS_OPER_ACT` decimal(20,4) DEFAULT NULL COMMENT '间接法-经营活动产生的现金流量净额',
  `CONV_DEBT_INTO_CAP` decimal(20,4) DEFAULT NULL COMMENT '债务转为资本',
  `CONV_CORP_BONDS_DUE_WITHIN_1Y` decimal(20,4) DEFAULT NULL COMMENT '一年内到期的可转换公司债券',
  `FA_FNC_LEASES` decimal(20,4) DEFAULT NULL COMMENT '融资租入固定资产',
  `END_BAL_CASH` decimal(20,4) DEFAULT NULL COMMENT '现金的期末余额',
  `LESS_BEG_BAL_CASH` decimal(20,4) DEFAULT NULL COMMENT '减:现金的期初余额',
  `PLUS_END_BAL_CASH_EQU` decimal(20,4) DEFAULT NULL COMMENT '加:现金等价物的期末余额',
  `LESS_BEG_BAL_CASH_EQU` decimal(20,4) DEFAULT NULL COMMENT '减:现金等价物的期初余额',
  `IM_NET_INCR_CASH_CASH_EQU` decimal(20,4) DEFAULT NULL COMMENT '间接法-现金及现金等价物净增加额',
  `FREE_CASH_FLOW` decimal(20,4) DEFAULT NULL COMMENT '企业自由现金流量(FCFF)',
  `COMP_TYPE_CODE` varchar(2) DEFAULT NULL COMMENT '公司类型代码',
  `ACTUAL_ANN_DT` varchar(8) DEFAULT NULL COMMENT '实际公告日期',
  `SPE_BAL_CASH_INFLOWS_OPER` decimal(20,4) DEFAULT NULL COMMENT '经营活动现金流入差额(特殊报表科目)',
  `TOT_BAL_CASH_INFLOWS_OPER` decimal(20,4) DEFAULT NULL COMMENT '经营活动现金流入差额(合计平衡项目)',
  `SPE_BAL_CASH_OUTFLOWS_OPER` decimal(20,4) DEFAULT NULL COMMENT '经营活动现金流出差额(特殊报表科目)',
  `TOT_BAL_CASH_OUTFLOWS_OPER` decimal(20,4) DEFAULT NULL COMMENT '经营活动现金流出差额(合计平衡项目)',
  `TOT_BAL_NETCASH_OUTFLOWS_OPER` decimal(20,4) DEFAULT NULL COMMENT '经营活动产生的现金流量净额差额(合计平衡项目)',
  `SPE_BAL_CASH_INFLOWS_INV` decimal(20,4) DEFAULT NULL COMMENT '投资活动现金流入差额(特殊报表科目)',
  `TOT_BAL_CASH_INFLOWS_INV` decimal(20,4) DEFAULT NULL COMMENT '投资活动现金流入差额(合计平衡项目)',
  `SPE_BAL_CASH_OUTFLOWS_INV` decimal(20,4) DEFAULT NULL COMMENT '投资活动现金流出差额(特殊报表科目)',
  `TOT_BAL_CASH_OUTFLOWS_INV` decimal(20,4) DEFAULT NULL COMMENT '投资活动现金流出差额(合计平衡项目)',
  `TOT_BAL_NETCASH_OUTFLOWS_INV` decimal(20,4) DEFAULT NULL COMMENT '投资活动产生的现金流量净额差额(合计平衡项目)',
  `SPE_BAL_CASH_INFLOWS_FNC` decimal(20,4) DEFAULT NULL COMMENT '筹资活动现金流入差额(特殊报表科目)',
  `TOT_BAL_CASH_INFLOWS_FNC` decimal(20,4) DEFAULT NULL COMMENT '筹资活动现金流入差额(合计平衡项目)',
  `SPE_BAL_CASH_OUTFLOWS_FNC` decimal(20,4) DEFAULT NULL COMMENT '筹资活动现金流出差额(特殊报表科目)',
  `TOT_BAL_CASH_OUTFLOWS_FNC` decimal(20,4) DEFAULT NULL COMMENT '筹资活动现金流出差额(合计平衡项目)',
  `TOT_BAL_NETCASH_OUTFLOWS_FNC` decimal(20,4) DEFAULT NULL COMMENT '筹资活动产生的现金流量净额差额(合计平衡项目)',
  `SPE_BAL_NETCASH_INC` decimal(20,4) DEFAULT NULL COMMENT '现金净增加额差额(特殊报表科目)',
  `TOT_BAL_NETCASH_INC` decimal(20,4) DEFAULT NULL COMMENT '现金净增加额差额(合计平衡项目)',
  `SPE_BAL_NETCASH_EQU_UNDIR` decimal(20,4) DEFAULT NULL COMMENT '间接法-经营活动现金流量净额差额(特殊报表科目)',
  `TOT_BAL_NETCASH_EQU_UNDIR` decimal(20,4) DEFAULT NULL COMMENT '间接法-经营活动现金流量净额差额(合计平衡项目)',
  `SPE_BAL_NETCASH_INC_UNDIR` decimal(20,4) DEFAULT NULL COMMENT '间接法-现金净增加额差额(特殊报表科目)',
  `TOT_BAL_NETCASH_INC_UNDIR` decimal(20,4) DEFAULT NULL COMMENT '间接法-现金净增加额差额(合计平衡项目)',
  `S_INFO_COMPCODE` varchar(10) DEFAULT NULL COMMENT '公司ID',
  `OPDATE` datetime DEFAULT NULL,
  `OPMODE` varchar(1) DEFAULT NULL,
  PRIMARY KEY (`OBJECT_ID`),
  KEY `STATEMENT_TYPE` (`STATEMENT_TYPE`)
) ENGINE=InnoDB DEFAULT CHARSET=gbk;

@krlmlr
Copy link
Member

krlmlr commented Sep 26, 2017

Thanks. Can you replicate with your local MariaDB server, if you copy the data to your local server?

@renkun-ken
Copy link
Contributor Author

I dump the table to a self-contained .sql and restore it on local MariaDB server and there's no problem reading the whole table.

@krlmlr
Copy link
Member

krlmlr commented Sep 26, 2017

Ouch. So there might be a problem with how the database server transmits the data?

Could you try replicating your server setup in a Docker container?

@renkun-ken
Copy link
Contributor Author

renkun-ken commented Sep 26, 2017

I tried with devtools::install_github("rstats-db/[email protected]") and it installs [email protected]. I query the table with this version and no crash occurs.

@krlmlr
Copy link
Member

krlmlr commented Sep 26, 2017

I recently added full buffering to work around another problem with the MariaDB libraries. Can you please try devtools::install_github("rstats-db/[email protected]") ?

@renkun-ken
Copy link
Contributor Author

v0.11-7 does not crash. There must be something mishandled in the subsequent changes.

@renkun-ken
Copy link
Contributor Author

I also notice that with v0.11-8, most other tables are retrievable but much more slowly than on a Fedora client (not the db server). v0.11-7 does not exhibit such performance drawback.

@krlmlr
Copy link
Member

krlmlr commented Sep 26, 2017

Thanks again. Can you please check devtools::install_github("rstats-db/RMariaDB@b-suspect") ? This is 0.11-8 minus the change that makes the entire result set available on the client.

@renkun-ken
Copy link
Contributor Author

I tried RMariaDB@b-suspect and the outcome is mixed. As long as the package is built against libmysqlclient-dev, it works smoothly. Otherwise (libmariadb-client-lgpl-dev) the session must crash.

@renkun-ken
Copy link
Contributor Author

Sorry for not controlling all the variables. I just notice that the library the package is built against does affect if it crashes.

With libmysqlclient-dev, RMariaDB@b-suspect works smoothly.
With libmariadb-client-lgpl-dev, no version works.

Following is the crash message using [email protected]:

Rscript mariadb-test.R
Loading required package: methods
*** Error in `/usr/lib/R/bin/exec/R': malloc(): memory corruption: 0x0000000002f06c40 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7f79025547e5]
/lib/x86_64-linux-gnu/libc.so.6(+0x8213e)[0x7f790255f13e]
/lib/x86_64-linux-gnu/libc.so.6(__libc_malloc+0x54)[0x7f7902561184]
/usr/lib/x86_64-linux-gnu/libmariadb.so.2(+0x26a49)[0x7f78e9e20a49]
/usr/lib/x86_64-linux-gnu/libmariadb.so.2(+0x24797)[0x7f78e9e1e797]
/usr/lib/x86_64-linux-gnu/libmariadb.so.2(+0x1d72b)[0x7f78e9e1772b]
/usr/lib/x86_64-linux-gnu/libmariadb.so.2(+0x1ddfe)[0x7f78e9e17dfe]
/usr/lib/x86_64-linux-gnu/libmariadb.so.2(mysql_stmt_execute+0x147)[0x7f78e9e28277]
/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/RMariaDB/libs/RMariaDB.so(_ZN11MariaResult7executeEv+0x11)[0x7f78ea0641d1]
/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/RMariaDB/libs/RMariaDB.so(_ZN11MariaResult10send_queryENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x7c8)[0x7f78ea066078]
/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/RMariaDB/libs/RMariaDB.so(_Z13result_createN4Rcpp4XPtrIN5boost10shared_ptrI15MariaConnectionEENS_15PreserveStorageEXadL_ZNS_25standard_delete_finalizerIS4_EEvPT_EELb0EEENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0xd0)[0x7f78ea07a550]
/home/renkun/R/x86_64-pc-linux-gnu-library/3.4/RMariaDB/libs/RMariaDB.so(_RMariaDB_result_create+0x18a)[0x7f78ea0725ba]
/usr/lib/R/lib/libR.so(+0xd2d7c)[0x7f7902b96d7c]
/usr/lib/R/lib/libR.so(Rf_eval+0x7bd)[0x7f7902bd3b4d]
/usr/lib/R/lib/libR.so(+0x1125ee)[0x7f7902bd65ee]
/usr/lib/R/lib/libR.so(Rf_eval+0x59c)[0x7f7902bd392c]
/usr/lib/R/lib/libR.so(+0x11194f)[0x7f7902bd594f]
/usr/lib/R/lib/libR.so(Rf_eval+0x366)[0x7f7902bd36f6]
/usr/lib/R/lib/libR.so(+0x10fe59)[0x7f7902bd3e59]
/usr/lib/R/lib/libR.so(Rf_eval+0x25c)[0x7f7902bd35ec]
/usr/lib/R/lib/libR.so(+0x10fe59)[0x7f7902bd3e59]
/usr/lib/R/lib/libR.so(Rf_eval+0x25c)[0x7f7902bd35ec]
/usr/lib/R/lib/libR.so(+0x10a675)[0x7f7902bce675]
/usr/lib/R/lib/libR.so(Rf_eval+0x198)[0x7f7902bd3528]
/usr/lib/R/lib/libR.so(+0x11194f)[0x7f7902bd594f]
/usr/lib/R/lib/libR.so(R_execMethod+0x256)[0x7f7902bd5f16]
/usr/lib/R/library/methods/libs/methods.so(+0x3d09)[0x7f78eadccd09]
/usr/lib/R/lib/libR.so(+0x1488cb)[0x7f7902c0c8cb]
/usr/lib/R/lib/libR.so(+0x10821f)[0x7f7902bcc21f]
/usr/lib/R/lib/libR.so(Rf_eval+0x198)[0x7f7902bd3528]
/usr/lib/R/lib/libR.so(+0x11194f)[0x7f7902bd594f]
/usr/lib/R/lib/libR.so(+0x108ac6)[0x7f7902bccac6]
/usr/lib/R/lib/libR.so(Rf_eval+0x198)[0x7f7902bd3528]
/usr/lib/R/lib/libR.so(+0x11194f)[0x7f7902bd594f]
/usr/lib/R/lib/libR.so(Rf_eval+0x366)[0x7f7902bd36f6]
/usr/lib/R/lib/libR.so(+0x113756)[0x7f7902bd7756]
/usr/lib/R/lib/libR.so(Rf_eval+0x59c)[0x7f7902bd392c]
/usr/lib/R/lib/libR.so(+0x1125ee)[0x7f7902bd65ee]
/usr/lib/R/lib/libR.so(Rf_eval+0x59c)[0x7f7902bd392c]
/usr/lib/R/lib/libR.so(+0x11194f)[0x7f7902bd594f]
/usr/lib/R/lib/libR.so(Rf_eval+0x366)[0x7f7902bd36f6]
/usr/lib/R/lib/libR.so(+0x1125ee)[0x7f7902bd65ee]
/usr/lib/R/lib/libR.so(Rf_eval+0x59c)[0x7f7902bd392c]
/usr/lib/R/lib/libR.so(+0x11194f)[0x7f7902bd594f]
/usr/lib/R/lib/libR.so(R_execMethod+0x256)[0x7f7902bd5f16]
/usr/lib/R/library/methods/libs/methods.so(+0x3d09)[0x7f78eadccd09]
/usr/lib/R/lib/libR.so(+0x1488cb)[0x7f7902c0c8cb]
/usr/lib/R/lib/libR.so(Rf_eval+0x706)[0x7f7902bd3a96]
/usr/lib/R/lib/libR.so(+0x113756)[0x7f7902bd7756]
/usr/lib/R/lib/libR.so(Rf_eval+0x59c)[0x7f7902bd392c]
/usr/lib/R/lib/libR.so(+0x1125ee)[0x7f7902bd65ee]
/usr/lib/R/lib/libR.so(Rf_eval+0x59c)[0x7f7902bd392c]
/usr/lib/R/lib/libR.so(+0x11194f)[0x7f7902bd594f]
/usr/lib/R/lib/libR.so(Rf_eval+0x366)[0x7f7902bd36f6]
/usr/lib/R/lib/libR.so(+0x113756)[0x7f7902bd7756]
/usr/lib/R/lib/libR.so(Rf_eval+0x59c)[0x7f7902bd392c]
/usr/lib/R/lib/libR.so(+0x1125ee)[0x7f7902bd65ee]
/usr/lib/R/lib/libR.so(Rf_eval+0x59c)[0x7f7902bd392c]
/usr/lib/R/lib/libR.so(+0x11194f)[0x7f7902bd594f]
/usr/lib/R/lib/libR.so(R_execMethod+0x256)[0x7f7902bd5f16]
/usr/lib/R/library/methods/libs/methods.so(+0x3d09)[0x7f78eadccd09]
/usr/lib/R/lib/libR.so(+0x1488cb)[0x7f7902c0c8cb]
/usr/lib/R/lib/libR.so(Rf_eval+0x706)[0x7f7902bd3a96]
======= Memory map: ========
00400000-00401000 r-xp 00000000 08:02 11692485                           /usr/lib/R/bin/exec/R
00600000-00601000 r--p 00000000 08:02 11692485                           /usr/lib/R/bin/exec/R
00601000-00602000 rw-p 00001000 08:02 11692485                           /usr/lib/R/bin/exec/R
00ea6000-034f9000 rw-p 00000000 00:00 0                                  [heap]
7f78e4000000-7f78e4021000 rw-p 00000000 00:00 0
7f78e4021000-7f78e8000000 ---p 00000000 00:00 0
7f78e953b000-7f78e9546000 r-xp 00000000 08:02 2360810                    /lib/x86_64-linux-gnu/libnss_files-2.23.so
7f78e9546000-7f78e9745000 ---p 0000b000 08:02 2360810                    /lib/x86_64-linux-gnu/libnss_files-2.23.so
7f78e9745000-7f78e9746000 r--p 0000a000 08:02 2360810                    /lib/x86_64-linux-gnu/libnss_files-2.23.so
7f78e9746000-7f78e9747000 rw-p 0000b000 08:02 2360810                    /lib/x86_64-linux-gnu/libnss_files-2.23.so
7f78e9747000-7f78e974d000 rw-p 00000000 00:00 0
7f78e974d000-7f78e9967000 r-xp 00000000 08:02 2359502                    /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7f78e9967000-7f78e9b66000 ---p 0021a000 08:02 2359502                    /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7f78e9b66000-7f78e9b82000 r--p 00219000 08:02 2359502                    /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7f78e9b82000-7f78e9b8e000 rw-p 00235000 08:02 2359502                    /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
7f78e9b8e000-7f78e9b91000 rw-p 00000000 00:00 0
7f78e9b91000-7f78e9bef000 r-xp 00000000 08:02 2359506                    /lib/x86_64-linux-gnu/libssl.so.1.0.0
7f78e9bef000-7f78e9def000 ---p 0005e000 08:02 2359506                    /lib/x86_64-linux-gnu/libssl.so.1.0.0
7f78e9def000-7f78e9df3000 r--p 0005e000 08:02 2359506                    /lib/x86_64-linux-gnu/libssl.so.1.0.0
7f78e9df3000-7f78e9dfa000 rw-p 00062000 08:02 2359506                    /lib/x86_64-linux-gnu/libssl.so.1.0.0
7f78e9dfa000-7f78e9e3c000 r-xp 00000000 08:02 10357775                   /usr/lib/x86_64-linux-gnu/libmariadb.so.2
7f78e9e3c000-7f78ea03c000 ---p 00042000 08:02 10357775                   /usr/lib/x86_64-linux-gnu/libmariadb.so.2
7f78ea03c000-7f78ea03f000 r--p 00042000 08:02 10357775                   /usr/lib/x86_64-linux-gnu/libmariadb.so.2
7f78ea03f000-7f78ea041000 rw-p 00045000 08:02 10357775                   /usr/lib/x86_64-linux-gnu/libmariadb.so.2
7f78ea041000-7f78ea048000 rw-p 00000000 00:00 0
7f78ea048000-7f78ea083000 r-xp 00000000 00:2e 7733293                    /home/renkun/R/x86_64-pc-linux-gnu-library/3.4/RMariaDB/libs/RMariaDB.so
7f78ea083000-7f78ea283000 ---p 0003b000 00:2e 7733293                    /home/renkun/R/x86_64-pc-linux-gnu-library/3.4/RMariaDB/libs/RMariaDB.so
7f78ea283000-7f78ea284000 r--p 0003b000 00:2e 7733293                    /home/renkun/R/x86_64-pc-linux-gnu-library/3.4/RMariaDB/libs/RMariaDB.so
7f78ea284000-7f78ea285000 rw-p 0003c000 00:2e 7733293                    /home/renkun/R/x86_64-pc-linux-gnu-library/3.4/RMariaDB/libs/RMariaDB.so
7f78ea285000-7f78ea286000 rw-p 00000000 00:00 0
7f78ea286000-7f78ea2a0000 r-xp 00000000 00:2e 3146485                    /home/renkun/R/x86_64-pc-linux-gnu-library/3.4/bit64/libs/bit64.so
7f78ea2a0000-7f78ea4a0000 ---p 0001a000 00:2e 3146485                    /home/renkun/R/x86_64-pc-linux-gnu-library/3.4/bit64/libs/bit64.so
7f78ea4a0000-7f78ea4a1000 r--p 0001a000 00:2e 3146485                    /home/renkun/R/x86_64-pc-linux-gnu-library/3.4/bit64/libs/bit64.so
7f78ea4a1000-7f78ea4a2000 rw-p 0001b000 00:2e 3146485                    /home/renkun/R/x86_64-pc-linux-gnu-library/3.4/bit64/libs/bit64.so
7f78ea4a2000-7f78ea4a8000 r-xp 00000000 00:2e 3146362                    /home/renkun/R/x86_64-pc-linux-gnu-library/3.4/bit/libs/bit.so
7f78ea4a8000-7f78ea6a7000 ---p 00006000 00:2e 3146362                    /home/renkun/R/x86_64-pc-linux-gnu-library/3.4/bit/libs/bit.so
7f78ea6a7000-7f78ea6a8000 r--p 00005000 00:2e 3146362                    /home/renkun/R/x86_64-pc-linux-gnu-library/3.4/bit/libs/bit.so
7f78ea6a8000-7f78ea6a9000 rw-p 00006000 00:2e 3146362                    /home/renkun/R/x86_64-pc-linux-gnu-library/3.4/bit/libs/bit.so
7f78ea6a9000-7f78ea81b000 r-xp 00000000 08:02 10356294                   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f78ea81b000-7f78eaa1b000 ---p 00172000 08:02 10356294                   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f78eaa1b000-7f78eaa25000 r--p 00172000 08:02 10356294                   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f78eaa25000-7f78eaa27000 rw-p 0017c000 08:02 10356294                   /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21
7f78eaa27000-7f78eaa2b000 rw-p 00000000 00:00 0
7f78eaa2b000-7f78eaa86000 r-xp 00000000 00:2e 3146678                    /home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/libs/Rcpp.so
7f78eaa86000-7f78eac86000 ---p 0005b000 00:2e 3146678                    /home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/libs/Rcpp.so
7f78eac86000-7f78eac87000 r--p 0005b000 00:2e 3146678                    /home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/libs/Rcpp.so
7f78eac87000-7f78eac88000 rw-p 0005c000 00:2e 3146678                    /home/renkun/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/libs/Rcpp.so
7f78eac88000-7f78eadc9000 rw-p 00000000 00:00 0
7f78eadc9000-7f78eadd1000 r-xp 00000000 08:02 11933170                   /usr/lib/R/library/methods/libs/methods.so
7f78eadd1000-7f78eafd0000 ---p 00008000 08:02 11933170                   /usr/lib/R/library/methods/libs/methods.so
7f78eafd0000-7f78eafd1000 r--p 00007000 08:02 11933170                   /usr/lib/R/library/methods/libs/methods.so
7f78eafd1000-7f78eafd2000 rw-p 00008000 08:02 11933170                   /usr/lib/R/library/methods/libs/methods.so
7f78eafd2000-7f78eb000000 rw-p 00000000 00:00 0
7f78eb000000-7f78eb5e0000 r-xp 00000000 08:02 12453016                   /usr/lib/openblas-base/liblapack.so.3
7f78eb5e0000-7f78eb7e0000 ---p 005e0000 08:02 12453016                   /usr/lib/openblas-base/liblapack.so.3
7f78eb7e0000-7f78eb7e1000 r--p 005e0000 08:02 12453016                   /usr/lib/openblas-base/liblapack.so.3
7f78eb7e1000-7f78eb7e3000 rw-p 005e1000 08:02 12453016                   /usr/lib/openblas-base/liblapack.so.3
7f78eb802000-7f78eb8a4000 r-xp 00000000 08:02 11812845                   /usr/lib/R/library/stats/libs/stats.so
7f78eb8a4000-7f78ebaa4000 ---p 000a2000 08:02 11812845                   /usr/lib/R/library/stats/libs/stats.so
7f78ebaa4000-7f78ebaa6000 r--p 000a2000 08:02 11812845                   /usr/lib/R/library/stats/libs/stats.so
7f78ebaa6000-7f78ebaa7000 rw-p 000a4000 08:02 11812845                   /usr/lib/R/library/stats/libs/stats.so
7f78ebaa7000-7f78ebc2e000 rw-p 00000000 00:00 0
7f78ebc2e000-7f78ebc6e000 r-xp 00000000 08:02 11931760                   /usr/lib/R/library/graphics/libs/graphics.so
7f78ebc6e000-7f78ebe6d000 ---p 00040000 08:02 11931760                   /usr/lib/R/library/graphics/libs/graphics.so
7f78ebe6d000-7f78ebe6e000 r--p 0003f000 08:02 11931760                   /usr/lib/R/library/graphics/libs/graphics.so
7f78ebe6e000-7f78ebe6f000 rw-p 00040000 08:02 11931760                   /usr/lib/R/library/graphics/libs/graphics.so
7f78ebe6f000-7f78ebebc000 rw-p 00000000 00:00 0
7f78ebebc000-7f78ebef1000 r-xp 00000000 08:02 12193250                   /usr/lib/R/library/grDevices/libs/grDevices.so
7f78ebef1000-7f78ec0f0000 ---p 00035000 08:02 12193250                   /usr/lib/R/library/grDevices/libs/grDevices.so
7f78ec0f0000-7f78ec0f5000 r--p 00034000 08:02 12193250                   /usr/lib/R/library/grDevices/libs/grDevices.so
7f78ec0f5000-7f78ec0f7000 rw-p 00039000 08:02 12193250                   /usr/lib/R/library/grDevices/libs/grDevices.so
7f78ec0f7000-7f78ec12a000 rw-p 00000000 00:00 0
7f78ec12a000-7f78ec134000 r-xp 00000000 08:02 11812799                   /usr/lib/R/library/utils/libs/utils.so
7f78ec134000-7f78ec333000 ---p 0000a000 08:02 11812799                   /usr/lib/R/library/utils/libs/utils.so
7f78ec333000-7f78ec334000 r--p 00009000 08:02 11812799                   /usr/lib/R/library/utils/libs/utils.so
7f78ec334000-7f78ec335000 rw-p 0000a000 08:02 11812799                   /usr/lib/R/library/utils/libs/utils.so
7f78ec335000-7f78ec40f000 rw-p 00000000 00:00 0
7f78ec467000-7f78ec775000 rw-p 00000000 00:00 0
7f78ec775000-7f78ecbff000 r--p 00000000 08:02 10354900                   /usr/lib/locale/locale-archive
7f78ecbff000-7f78f0bff000 rw-p 00000000 00:00 0
7f78f0bff000-7f78f0c00000 ---p 00000000 00:00 0
7f78f0c00000-7f78f1400000 rw-p 00000000 00:00 0
7f78f1400000-7f78f3400000 rw-p 00000000 00:00 0
7f78f3400000-7f78f3401000 ---p 00000000 00:00 0
7f78f3401000-7f78f3c01000 rw-p 00000000 00:00 0
7f78f3c01000-7f78f5c01000 rw-p 00000000 00:00 0
7f78f5c01000-7f78f5c02000 ---p 00000000 00:00 0
7f78f5c02000-7f78f6402000 rw-p 00000000 00:00 0
7f78f6402000-7f78f8402000 rw-p 00000000 00:00 0
7f78f8402000-7f78f8403000 ---p 00000000 00:00 0
7f78f8403000-7f78f8c03000 rw-p 00000000 00:00 0
7f78f8c03000-7f78fcc03000 rw-p 00000000 00:00 0
7f78fcc03000-7f78fcc04000 ---p 00000000 00:00 0
7f78fcc04000-7f78fd404000 rw-p 00000000 00:00 0
7f78fd404000-7f78fd405000 ---p 00000000 00:00 0
7f78fd405000-7f78fdc05000 rw-p 00000000 00:00 0
7f78fdc05000-7f78fdc06000 ---p 00000000 00:00 0
7f78fdc06000-7f78fe406000 rw-p 00000000 00:00 0
7f78fe406000-7f78fe41c000 r-xp 00000000 08:02 2363801                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f78fe41c000-7f78fe61b000 ---p 00016000 08:02 2363801                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f78fe61b000-7f78fe61c000 rw-p 00015000 08:02 2363801                    /lib/x86_64-linux-gnu/libgcc_s.so.1
7f78fe61c000-7f78fe65a000 r-xp 00000000 08:02 10366800                   /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
7f78fe65a000-7f78fe859000 ---p 0003e000 08:02 10366800                   /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
7f78fe859000-7f78fe85a000 r--p 0003d000 08:02 10366800                   /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
7f78fe85a000-7f78fe85b000 rw-p 0003e000 08:02 10366800                   /usr/lib/x86_64-linux-gnu/libquadmath.so.0.0.0
7f78fe85b000-7f78fe984000 r-xp 00000000 08:02 10362867                   /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
7f78fe984000-7f78feb83000 ---p 00129000 08:02 10362867                   /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
7f78feb83000-7f78feb84000 r--p 00128000 08:02 10362867                   /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
7f78feb84000-7f78feb86000 rw-p 00129000 08:02 10362867                   /usr/lib/x86_64-linux-gnu/libgfortran.so.3.0.0
7f78feb86000-7f78febab000 r-xp 00000000 08:02 2363935                    /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f78febab000-7f78fedaa000 ---p 00025000 08:02 2363935                    /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f78fedaa000-7f78fedae000 r--p 00024000 08:02 2363935                    /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f78fedae000-7f78fedaf000 rw-p 00028000 08:02 2363935                    /lib/x86_64-linux-gnu/libtinfo.so.5.9
7f78fedaf000-7f7900c13000 r-xp 00000000 08:02 10356482                   /usr/lib/libopenblasp-r0.2.18.so
7f7900c13000-7f7900e12000 ---p 01e64000 08:02 10356482                   /usr/lib/libopenblasp-r0.2.18.so
7f7900e12000-7f7900e18000 r--p 01e63000 08:02 10356482                   /usr/lib/libopenblasp-r0.2.18.so
7f7900e18000-7f7900e2a000 rw-p 01e69000 08:02 10356482                   /usr/lib/libopenblasp-r0.2.18.so
7f7900e2a000-7f7900e43000 rw-p 00000000 00:00 0
7f7900e43000-7f7900e64000 r-xp 00000000 08:02 10364392                   /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0
7f7900e64000-7f7901063000 ---p 00021000 08:02 10364392                   /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0
7f7901063000-7f7901064000 r--p 00020000 08:02 10364392                   /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0
7f7901064000-7f7901065000 rw-p 00021000 08:02 10364392                   /usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0
7f7901065000-7f7901068000 r-xp 00000000 08:02 2360826                    /lib/x86_64-linux-gnu/libdl-2.23.so
7f7901068000-7f7901267000 ---p 00003000 08:02 2360826                    /lib/x86_64-linux-gnu/libdl-2.23.so
7f7901267000-7f7901268000 r--p 00002000 08:02 2360826                    /lib/x86_64-linux-gnu/libdl-2.23.so
7f7901268000-7f7901269000 rw-p 00003000 08:02 2360826                    /lib/x86_64-linux-gnu/libdl-2.23.so
7f7901269000-7f7901270000 r-xp 00000000 08:02 2360820                    /lib/x86_64-linux-gnu/librt-2.23.so
7f7901270000-7f790146f000 ---p 00007000 08:02 2360820                    /lib/x86_64-linux-gnu/librt-2.23.so
7f790146f000-7f7901470000 r--p 00006000 08:02 2360820                    /lib/x86_64-linux-gnu/librt-2.23.so
7f7901470000-7f7901471000 rw-p 00007000 08:02 2360820                    /lib/x86_64-linux-gnu/librt-2.23.so
7f7901471000-7f790148a000 r-xp 00000000 08:02 2359321                    /lib/x86_64-linux-gnu/libz.so.1.2.8
7f790148a000-7f7901689000 ---p 00019000 08:02 2359321                    /lib/x86_64-linux-gnu/libz.so.1.2.8
7f7901689000-7f790168a000 r--p 00018000 08:02 2359321                    /lib/x86_64-linux-gnu/libz.so.1.2.8
7f790168a000-7f790168b000 rw-p 00019000 08:02 2359321                    /lib/x86_64-linux-gnu/libz.so.1.2.8
7f790168b000-7f790169a000 r-xp 00000000 08:02 2363762                    /lib/x86_64-linux-gnu/libbz2.so.1.0.4
7f790169a000-7f7901899000 ---p 0000f000 08:02 2363762                    /lib/x86_64-linux-gnu/libbz2.so.1.0.4
7f7901899000-7f790189a000 r--p 0000e000 08:02 2363762                    /lib/x86_64-linux-gnu/libbz2.so.1.0.4
7f790189a000-7f790189b000 rw-p 0000f000 08:02 2363762                    /lib/x86_64-linux-gnu/libbz2.so.1.0.4
7f790189b000-7f79018bc000 r-xp 00000000 08:02 2363830                    /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7f79018bc000-7f7901abb000 ---p 00021000 08:02 2363830                    /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7f7901abb000-7f7901abc000 r--p 00020000 08:02 2363830                    /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7f7901abc000-7f7901abd000 rw-p 00021000 08:02 2363830                    /lib/x86_64-linux-gnu/liblzma.so.5.0.0
7f7901abd000-7f7901b2b000 r-xp 00000000 08:02 2363892                    /lib/x86_64-linux-gnu/libpcre.so.3.13.2
7f7901b2b000-7f7901d2b000 ---p 0006e000 08:02 2363892                    /lib/x86_64-linux-gnu/libpcre.so.3.13.2
7f7901d2b000-7f7901d2c000 r--p 0006e000 08:02 2363892                    /lib/x86_64-linux-gnu/libpcre.so.3.13.2
7f7901d2c000-7f7901d2d000 rw-p 0006f000 08:02 2363892                    /lib/x86_64-linux-gnu/libpcre.so.3.13.2
7f7901d2d000-7f7901d6a000 r-xp 00000000 08:02 2363914                    /lib/x86_64-linux-gnu/libreadline.so.6.3
7f7901d6a000-7f7901f6a000 ---p 0003d000 08:02 2363914                    /lib/x86_64-linux-gnu/libreadline.so.6.3
7f7901f6a000-7f7901f6c000 r--p 0003d000 08:02 2363914                    /lib/x86_64-linux-gnu/libreadline.so.6.3
7f7901f6c000-7f7901f72000 rw-p 0003f000 08:02 2363914                    /lib/x86_64-linux-gnu/libreadline.so.6.3
7f7901f72000-7f7901f73000 rw-p 00000000 00:00 0
7f7901f73000-7f790207b000 r-xp 00000000 08:02 2360838                    /lib/x86_64-linux-gnu/libm-2.23.so
7f790207b000-7f790227a000 ---p 00108000 08:02 2360838                    /lib/x86_64-linux-gnu/libm-2.23.so
7f790227a000-7f790227b000 r--p 00107000 08:02 2360838                    /lib/x86_64-linux-gnu/libm-2.23.so
7f790227b000-7f790227c000 rw-p 00108000 08:02 2360838                    /lib/x86_64-linux-gnu/libm-2.23.so
7f790227c000-7f79022d7000 r-xp 00000000 08:02 12453015                   /usr/lib/openblas-base/libblas.so.3
7f79022d7000-7f79024d7000 ---p 0005b000 08:02 12453015                   /usr/lib/openblas-base/libblas.so.3
7f79024d7000-7f79024dc000 r--p 0005b000 08:02 12453015                   /usr/lib/openblas-base/libblas.so.3
7f79024dc000-7f79024dd000 rw-p 00060000 08:02 12453015                   /usr/lib/openblas-base/libblas.so.3
7f79024dd000-7f790269d000 r-xp 00000000 08:02 2360848                    /lib/x86_64-linux-gnu/libc-2.23.so
7f790269d000-7f790289d000 ---p 001c0000 08:02 2360848                    /lib/x86_64-linux-gnu/libc-2.23.so
7f790289d000-7f79028a1000 r--p 001c0000 08:02 2360848                    /lib/x86_64-linux-gnu/libc-2.23.so
7f79028a1000-7f79028a3000 rw-p 001c4000 08:02 2360848                    /lib/x86_64-linux-gnu/libc-2.23.so
7f79028a3000-7f79028a7000 rw-p 00000000 00:00 0
7f79028a7000-7f79028bf000 r-xp 00000000 08:02 2360814                    /lib/x86_64-linux-gnu/libpthread-2.23.so
7f79028bf000-7f7902abe000 ---p 00018000 08:02 2360814                    /lib/x86_64-linux-gnu/libpthread-2.23.so
7f7902abe000-7f7902abf000 r--p 00017000 08:02 2360814                    /lib/x86_64-linux-gnu/libpthread-2.23.so
7f7902abf000-7f7902ac0000 rw-p 00018000 08:02 2360814                    /lib/x86_64-linux-gnu/libpthread-2.23.so
7f7902ac0000-7f7902ac4000 rw-p 00000000 00:00 0
7f7902ac4000-7f7902d72000 r-xp 00000000 08:02 11692527                   /usr/lib/R/lib/libR.so
7f7902d72000-7f7902f72000 ---p 002ae000 08:02 11692527                   /usr/lib/R/lib/libR.so
7f7902f72000-7f7902f8f000 r--p 002ae000 08:02 11692527                   /usr/lib/R/lib/libR.so
7f7902f8f000-7f7902f9a000 rw-p 002cb000 08:02 11692527                   /usr/lib/R/lib/libR.so
7f7902f9a000-7f79030eb000 rw-p 00000000 00:00 0
7f79030eb000-7f7903111000 r-xp 00000000 08:02 2360804                    /lib/x86_64-linux-gnu/ld-2.23.so
7f7903116000-7f79032ef000 rw-p 00000000 00:00 0
7f7903305000-7f7903306000 rw-p 00000000 00:00 0
7f7903306000-7f7903307000 r--p 00000000 08:02 12064258                   /usr/lib/R/library/translations/en/LC_MESSAGES/R.mo
7f7903307000-7f790330e000 r--s 00000000 08:02 10626860                   /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
7f790330e000-7f7903310000 rw-p 00000000 00:00 0
7f7903310000-7f7903311000 r--p 00025000 08:02 2360804                    /lib/x86_64-linux-gnu/ld-2.23.so
7f7903311000-7f7903312000 rw-p 00026000 08:02 2360804                    /lib/x86_64-linux-gnu/ld-2.23.so
7f7903312000-7f7903313000 rw-p 00000000 00:00 0
7ffd25f57000-7ffd25f80000 rw-p 00000000 00:00 0                          [stack]
7ffd25f80000-7ffd25f82000 r--p 00000000 00:00 0                          [vvar]
7ffd25f82000-7ffd25f84000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
[1]    31296 abort (core dumped)  Rscript mariadb-test.R

[email protected], [email protected], [email protected]

Loading required package: methods
R: malloc.c:2394: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed.
[1]    32208 abort (core dumped)  Rscript mariadb-test.R

@krlmlr
Copy link
Member

krlmlr commented Sep 26, 2017

Thanks for helping troubleshooting this. In this case, it might help trying to install Connector/C from source, and reinstall RMariaDB so that the version compiled from source is used. (Double-check by running mariadb_config.)

I'll try to replicate your setup with a local MySQL server.

@krlmlr
Copy link
Member

krlmlr commented Sep 26, 2017

I have created a table with your structure with 1e6 random records in my local MySQL server. Neither the b-suspect nor the master branch showed the error you are seeing. I'm on Ubuntu 17.04 with libmariadbclient-dev 10.1.25.

@renkun-ken
Copy link
Contributor Author

renkun-ken commented Sep 27, 2017

I can only reproduce the crash under the following condition on existing db:

DB: MySQL Server 5.7.15 on Fedora 24 with libmysqlclient
Client: RMariaDB (any version) on Ubuntu 16.04.3 with libmariadb-client-lgpl-dev.

ASHARECASHFLOW is so far the only table I find would cause a crash. Many other tables won't because our production system already uses RMariaDB to query tens of tables per day from the same DB server and no crash occurs.

@krlmlr
Copy link
Member

krlmlr commented Sep 27, 2017

Can you replicate it with the following code? I'm using utf8 encoding.

library(DBI)
devtools::load_all()

set.seed(20170926)

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

query <- "DROP TABLE `ASHARECASHFLOW`"
dbExecute(con, query)

query <- "
CREATE TABLE `ASHARECASHFLOW` (
  `OBJECT_ID` varchar(100) NOT NULL COMMENT '对象ID',
`S_INFO_WINDCODE` varchar(40) DEFAULT NULL COMMENT 'Wind代码',
`WIND_CODE` varchar(40) DEFAULT NULL COMMENT 'Wind代码',
`ANN_DT` varchar(8) DEFAULT NULL COMMENT '公告日期',
`REPORT_PERIOD` varchar(8) DEFAULT NULL COMMENT '报告期',
`STATEMENT_TYPE` varchar(10) DEFAULT NULL COMMENT '报表类型',
`CRNCY_CODE` varchar(10) DEFAULT NULL COMMENT '货币代码',
`CASH_RECP_SG_AND_RS` decimal(20,4) DEFAULT NULL COMMENT '销售商品、提供劳务收到的现金',
`RECP_TAX_RENDS` decimal(20,4) DEFAULT NULL COMMENT '收到的税费返还',
`NET_INCR_DEP_COB` decimal(20,4) DEFAULT NULL COMMENT '客户存款和同业存放款项净增加额',
`NET_INCR_LOANS_CENTRAL_BANK` decimal(20,4) DEFAULT NULL COMMENT '向中央银行借款净增加额',
`NET_INCR_FUND_BORR_OFI` decimal(20,4) DEFAULT NULL COMMENT '向其他金融机构拆入资金净增加额',
`CASH_RECP_PREM_ORIG_INCO` decimal(20,4) DEFAULT NULL COMMENT '收到原保险合同保费取得的现金',
`NET_INCR_INSURED_DEP` decimal(20,4) DEFAULT NULL COMMENT '保户储金净增加额',
`NET_CASH_RECEIVED_REINSU_BUS` decimal(20,4) DEFAULT NULL COMMENT '收到再保业务现金净额',
`NET_INCR_DISP_TFA` decimal(20,4) DEFAULT NULL COMMENT '处置交易性金融资产净增加额',
`NET_INCR_INT_HANDLING_CHRG` decimal(20,4) DEFAULT NULL COMMENT '收取利息和手续费净增加额',
`NET_INCR_DISP_FAAS` decimal(20,4) DEFAULT NULL COMMENT '处置可供出售金融资产净增加额',
`NET_INCR_LOANS_OTHER_BANK` decimal(20,4) DEFAULT NULL COMMENT '拆入资金净增加额',
`NET_INCR_REPURCH_BUS_FUND` decimal(20,4) DEFAULT NULL COMMENT '回购业务资金净增加额',
`OTHER_CASH_RECP_RAL_OPER_ACT` decimal(20,4) DEFAULT NULL COMMENT '收到其他与经营活动有关的现金',
`STOT_CASH_INFLOWS_OPER_ACT` decimal(20,4) DEFAULT NULL COMMENT '经营活动现金流入小计',
`CASH_PAY_GOODS_PURCH_SERV_REC` decimal(20,4) DEFAULT NULL COMMENT '购买商品、接受劳务支付的现金',
`CASH_PAY_BEH_EMPL` decimal(20,4) DEFAULT NULL COMMENT '支付给职工以及为职工支付的现金',
`PAY_ALL_TYP_TAX` decimal(20,4) DEFAULT NULL COMMENT '支付的各项税费',
`NET_INCR_CLIENTS_LOAN_ADV` decimal(20,4) DEFAULT NULL COMMENT '客户贷款及垫款净增加额',
`NET_INCR_DEP_CBOB` decimal(20,4) DEFAULT NULL COMMENT '存放央行和同业款项净增加额',
`CASH_PAY_CLAIMS_ORIG_INCO` decimal(20,4) DEFAULT NULL COMMENT '支付原保险合同赔付款项的现金',
`HANDLING_CHRG_PAID` decimal(20,4) DEFAULT NULL COMMENT '支付手续费的现金',
`COMM_INSUR_PLCY_PAID` decimal(20,4) DEFAULT NULL COMMENT '支付保单红利的现金',
`OTHER_CASH_PAY_RAL_OPER_ACT` decimal(20,4) DEFAULT NULL COMMENT '支付其他与经营活动有关的现金',
`STOT_CASH_OUTFLOWS_OPER_ACT` decimal(20,4) DEFAULT NULL COMMENT '经营活动现金流出小计',
`NET_CASH_FLOWS_OPER_ACT` decimal(20,4) DEFAULT NULL COMMENT '经营活动产生的现金流量净额',
`CASH_RECP_DISP_WITHDRWL_INVEST` decimal(20,4) DEFAULT NULL COMMENT '收回投资收到的现金',
`CASH_RECP_RETURN_INVEST` decimal(20,4) DEFAULT NULL COMMENT '取得投资收益收到的现金',
`NET_CASH_RECP_DISP_FIOLTA` decimal(20,4) DEFAULT NULL COMMENT '处置固定资产、无形资产和其他长期资产收回的现金净额',
`NET_CASH_RECP_DISP_SOBU` decimal(20,4) DEFAULT NULL COMMENT '处置子公司及其他营业单位收到的现金净额',
`OTHER_CASH_RECP_RAL_INV_ACT` decimal(20,4) DEFAULT NULL COMMENT '收到其他与投资活动有关的现金',
`STOT_CASH_INFLOWS_INV_ACT` decimal(20,4) DEFAULT NULL COMMENT '投资活动现金流入小计',
`CASH_PAY_ACQ_CONST_FIOLTA` decimal(20,4) DEFAULT NULL COMMENT '购建固定资产、无形资产和其他长期资产支付的现金',
`CASH_PAID_INVEST` decimal(20,4) DEFAULT NULL COMMENT '投资支付的现金',
`NET_CASH_PAY_AQUIS_SOBU` decimal(20,4) DEFAULT NULL COMMENT '取得子公司及其他营业单位支付的现金净额',
`OTHER_CASH_PAY_RAL_INV_ACT` decimal(20,4) DEFAULT NULL COMMENT '支付其他与投资活动有关的现金',
`NET_INCR_PLEDGE_LOAN` decimal(20,4) DEFAULT NULL COMMENT '质押贷款净增加额',
`STOT_CASH_OUTFLOWS_INV_ACT` decimal(20,4) DEFAULT NULL COMMENT '投资活动现金流出小计',
`NET_CASH_FLOWS_INV_ACT` decimal(20,4) DEFAULT NULL COMMENT '投资活动产生的现金流量净额',
`CASH_RECP_CAP_CONTRIB` decimal(20,4) DEFAULT NULL COMMENT '吸收投资收到的现金',
`INCL_CASH_REC_SAIMS` decimal(20,4) DEFAULT NULL COMMENT '其中:子公司吸收少数股东投资收到的现金',
`CASH_RECP_BORROW` decimal(20,4) DEFAULT NULL COMMENT '取得借款收到的现金',
`PROC_ISSUE_BONDS` decimal(20,4) DEFAULT NULL COMMENT '发行债券收到的现金',
`OTHER_CASH_RECP_RAL_FNC_ACT` decimal(20,4) DEFAULT NULL COMMENT '收到其他与筹资活动有关的现金',
`STOT_CASH_INFLOWS_FNC_ACT` decimal(20,4) DEFAULT NULL COMMENT '筹资活动现金流入小计',
`CASH_PREPAY_AMT_BORR` decimal(20,4) DEFAULT NULL COMMENT '偿还债务支付的现金',
`CASH_PAY_DIST_DPCP_INT_EXP` decimal(20,4) DEFAULT NULL COMMENT '分配股利、利润或偿付利息支付的现金',
`INCL_DVD_PROFIT_PAID_SC_MS` decimal(20,4) DEFAULT NULL COMMENT '其中:子公司支付给少数股东的股利、利润',
`OTHER_CASH_PAY_RAL_FNC_ACT` decimal(20,4) DEFAULT NULL COMMENT '支付其他与筹资活动有关的现金',
`STOT_CASH_OUTFLOWS_FNC_ACT` decimal(20,4) DEFAULT NULL COMMENT '筹资活动现金流出小计',
`NET_CASH_FLOWS_FNC_ACT` decimal(20,4) DEFAULT NULL COMMENT '筹资活动产生的现金流量净额',
`EFF_FX_FLU_CASH` decimal(20,4) DEFAULT NULL COMMENT '汇率变动对现金的影响',
`NET_INCR_CASH_CASH_EQU` decimal(20,4) DEFAULT NULL COMMENT '现金及现金等价物净增加额',
`CASH_CASH_EQU_BEG_PERIOD` decimal(20,4) DEFAULT NULL COMMENT '期初现金及现金等价物余额',
`CASH_CASH_EQU_END_PERIOD` decimal(20,4) DEFAULT NULL COMMENT '期末现金及现金等价物余额',
`NET_PROFIT` decimal(20,4) DEFAULT NULL COMMENT '净利润',
`UNCONFIRMED_INVEST_LOSS` decimal(20,4) DEFAULT NULL COMMENT '未确认投资损失',
`PLUS_PROV_DEPR_ASSETS` decimal(20,4) DEFAULT NULL COMMENT '加:资产减值准备',
`DEPR_FA_COGA_DPBA` decimal(20,4) DEFAULT NULL COMMENT '固定资产折旧、油气资产折耗、生产性生物资产折旧',
`AMORT_INTANG_ASSETS` decimal(20,4) DEFAULT NULL COMMENT '无形资产摊销',
`AMORT_LT_DEFERRED_EXP` decimal(20,4) DEFAULT NULL COMMENT '长期待摊费用摊销',
`DECR_DEFERRED_EXP` decimal(20,4) DEFAULT NULL COMMENT '待摊费用减少',
`INCR_ACC_EXP` decimal(20,4) DEFAULT NULL COMMENT '预提费用增加',
`LOSS_DISP_FIOLTA` decimal(20,4) DEFAULT NULL COMMENT '处置固定、无形资产和其他长期资产的损失',
`LOSS_SCR_FA` decimal(20,4) DEFAULT NULL COMMENT '固定资产报废损失',
`LOSS_FV_CHG` decimal(20,4) DEFAULT NULL COMMENT '公允价值变动损失',
`FIN_EXP` decimal(20,4) DEFAULT NULL COMMENT '财务费用',
`INVEST_LOSS` decimal(20,4) DEFAULT NULL COMMENT '投资损失',
`DECR_DEFERRED_INC_TAX_ASSETS` decimal(20,4) DEFAULT NULL COMMENT '递延所得税资产减少',
`INCR_DEFERRED_INC_TAX_LIAB` decimal(20,4) DEFAULT NULL COMMENT '递延所得税负债增加',
`DECR_INVENTORIES` decimal(20,4) DEFAULT NULL COMMENT '存货的减少',
`DECR_OPER_PAYABLE` decimal(20,4) DEFAULT NULL COMMENT '经营性应收项目的减少',
`INCR_OPER_PAYABLE` decimal(20,4) DEFAULT NULL COMMENT '经营性应付项目的增加',
`OTHERS` decimal(20,4) DEFAULT NULL COMMENT '其他',
`IM_NET_CASH_FLOWS_OPER_ACT` decimal(20,4) DEFAULT NULL COMMENT '间接法-经营活动产生的现金流量净额',
`CONV_DEBT_INTO_CAP` decimal(20,4) DEFAULT NULL COMMENT '债务转为资本',
`CONV_CORP_BONDS_DUE_WITHIN_1Y` decimal(20,4) DEFAULT NULL COMMENT '一年内到期的可转换公司债券',
`FA_FNC_LEASES` decimal(20,4) DEFAULT NULL COMMENT '融资租入固定资产',
`END_BAL_CASH` decimal(20,4) DEFAULT NULL COMMENT '现金的期末余额',
`LESS_BEG_BAL_CASH` decimal(20,4) DEFAULT NULL COMMENT '减:现金的期初余额',
`PLUS_END_BAL_CASH_EQU` decimal(20,4) DEFAULT NULL COMMENT '加:现金等价物的期末余额',
`LESS_BEG_BAL_CASH_EQU` decimal(20,4) DEFAULT NULL COMMENT '减:现金等价物的期初余额',
`IM_NET_INCR_CASH_CASH_EQU` decimal(20,4) DEFAULT NULL COMMENT '间接法-现金及现金等价物净增加额',
`FREE_CASH_FLOW` decimal(20,4) DEFAULT NULL COMMENT '企业自由现金流量(FCFF)',
`COMP_TYPE_CODE` varchar(2) DEFAULT NULL COMMENT '公司类型代码',
`ACTUAL_ANN_DT` varchar(8) DEFAULT NULL COMMENT '实际公告日期',
`SPE_BAL_CASH_INFLOWS_OPER` decimal(20,4) DEFAULT NULL COMMENT '经营活动现金流入差额(特殊报表科目)',
`TOT_BAL_CASH_INFLOWS_OPER` decimal(20,4) DEFAULT NULL COMMENT '经营活动现金流入差额(合计平衡项目)',
`SPE_BAL_CASH_OUTFLOWS_OPER` decimal(20,4) DEFAULT NULL COMMENT '经营活动现金流出差额(特殊报表科目)',
`TOT_BAL_CASH_OUTFLOWS_OPER` decimal(20,4) DEFAULT NULL COMMENT '经营活动现金流出差额(合计平衡项目)',
`TOT_BAL_NETCASH_OUTFLOWS_OPER` decimal(20,4) DEFAULT NULL COMMENT '经营活动产生的现金流量净额差额(合计平衡项目)',
`SPE_BAL_CASH_INFLOWS_INV` decimal(20,4) DEFAULT NULL COMMENT '投资活动现金流入差额(特殊报表科目)',
`TOT_BAL_CASH_INFLOWS_INV` decimal(20,4) DEFAULT NULL COMMENT '投资活动现金流入差额(合计平衡项目)',
`SPE_BAL_CASH_OUTFLOWS_INV` decimal(20,4) DEFAULT NULL COMMENT '投资活动现金流出差额(特殊报表科目)',
`TOT_BAL_CASH_OUTFLOWS_INV` decimal(20,4) DEFAULT NULL COMMENT '投资活动现金流出差额(合计平衡项目)',
`TOT_BAL_NETCASH_OUTFLOWS_INV` decimal(20,4) DEFAULT NULL COMMENT '投资活动产生的现金流量净额差额(合计平衡项目)',
`SPE_BAL_CASH_INFLOWS_FNC` decimal(20,4) DEFAULT NULL COMMENT '筹资活动现金流入差额(特殊报表科目)',
`TOT_BAL_CASH_INFLOWS_FNC` decimal(20,4) DEFAULT NULL COMMENT '筹资活动现金流入差额(合计平衡项目)',
`SPE_BAL_CASH_OUTFLOWS_FNC` decimal(20,4) DEFAULT NULL COMMENT '筹资活动现金流出差额(特殊报表科目)',
`TOT_BAL_CASH_OUTFLOWS_FNC` decimal(20,4) DEFAULT NULL COMMENT '筹资活动现金流出差额(合计平衡项目)',
`TOT_BAL_NETCASH_OUTFLOWS_FNC` decimal(20,4) DEFAULT NULL COMMENT '筹资活动产生的现金流量净额差额(合计平衡项目)',
`SPE_BAL_NETCASH_INC` decimal(20,4) DEFAULT NULL COMMENT '现金净增加额差额(特殊报表科目)',
`TOT_BAL_NETCASH_INC` decimal(20,4) DEFAULT NULL COMMENT '现金净增加额差额(合计平衡项目)',
`SPE_BAL_NETCASH_EQU_UNDIR` decimal(20,4) DEFAULT NULL COMMENT '间接法-经营活动现金流量净额差额(特殊报表科目)',
`TOT_BAL_NETCASH_EQU_UNDIR` decimal(20,4) DEFAULT NULL COMMENT '间接法-经营活动现金流量净额差额(合计平衡项目)',
`SPE_BAL_NETCASH_INC_UNDIR` decimal(20,4) DEFAULT NULL COMMENT '间接法-现金净增加额差额(特殊报表科目)',
`TOT_BAL_NETCASH_INC_UNDIR` decimal(20,4) DEFAULT NULL COMMENT '间接法-现金净增加额差额(合计平衡项目)',
`S_INFO_COMPCODE` varchar(10) DEFAULT NULL COMMENT '公司ID',
`OPDATE` datetime DEFAULT NULL,
`OPMODE` varchar(1) DEFAULT NULL,
PRIMARY KEY (`OBJECT_ID`),
KEY `STATEMENT_TYPE` (`STATEMENT_TYPE`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
"

dbExecute(con, query)

tbl <- dbReadTable(con, "ASHARECASHFLOW")

N <- 1e6
data <- matrix(rnorm(N * ncol(tbl)), ncol = ncol(tbl))
colnames(data) <- colnames(tbl)
df <- as.data.frame(data)
df$OPDATE <- Sys.Date()
df$OPMODE <- rep(letters, N)[seq_len(N)]
df$COMP_TYPE_CODE <- rep(LETTERS, N)[seq_len(N)]
df$OBJECT_ID <- as.character(df$OBJECT_ID)

print(sum(duplicated(df$OBJECT_ID)))

dbWriteTable(con, "ASHARECASHFLOW", df, append = TRUE)

# Read table
data <- dbReadTable(con, "ASHARECASHFLOW")

@krlmlr krlmlr closed this as completed in 53e571d Sep 30, 2017
krlmlr added a commit that referenced this issue Oct 1, 2017
- Test almost all test cases of the DBI specification.
- Queries not supported by the prepared statement protocol can now be run via `dbExecute()` or `dbSendStatement()`, the function `mariadbExecQuery()` has been removed (#28).
- Avoid storing all results on the client due to instability with large datasets (#60, #61).
@renkun-ken
Copy link
Contributor Author

I test with the v0.11-9 against libmysqlclient-dev and no crash occurs any more. Thanks!

@krlmlr
Copy link
Member

krlmlr commented Oct 2, 2017

Thank you for extensive testing.

@renkun-ken
Copy link
Contributor Author

renkun-ken commented Jun 29, 2018

On Ubuntu 18.04, libmariadb-client-lgpl-dev is replaced with libmariadb-dev. I rebuild RMariaDB against this and test the same query, everything works fine.

On Ubuntu 16.04, it is still libmariadb-client-lgpl-dev and still does not work.

@github-actions
Copy link

github-actions bot commented Dec 7, 2020

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 Dec 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants