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

poped - unstable R sessions when using analytical solutions #130

Closed
TheoPapath opened this issue Oct 16, 2024 · 7 comments · Fixed by #133
Closed

poped - unstable R sessions when using analytical solutions #130

TheoPapath opened this issue Oct 16, 2024 · 7 comments · Fixed by #133

Comments

@TheoPapath
Copy link
Contributor

Not sure if this is an issue or not, but I have seen that for most (all?) problems that are based on analytical solutions, the R session is crashing. I cannot always replicate this from my end.

image

@mattfidler
Copy link
Member

Unless it can be replicated, I cannot fix it 😦

@mattfidler
Copy link
Member

If you have code that I can look at where this is occurring, then I can try to fix this.

@TheoPapath
Copy link
Contributor Author

@mattfidler
Copy link
Member

Thread 1 "R" received signal SIGSEGV, Segmentation fault.
rx_811c6d6fa0c165eef32ef80e785e6f99__calc_lhs (_cSub=0, __t=1, __zzStateVar__=<optimized out>, _lhs=0x7fffffff13f0) at rx_811c6d6fa0c165eef32ef80e785e6f99_.c:695
695	  _update_par_ptr(__t, _cSub, _solveData, _idx);
(gdb) bt
#0  rx_811c6d6fa0c165eef32ef80e785e6f99__calc_lhs (_cSub=0, __t=1, __zzStateVar__=<optimized out>, _lhs=0x7fffffff13f0)
    at rx_811c6d6fa0c165eef32ef80e785e6f99_.c:695
#1  0x00007fffed3b2382 in Rcpp::Vector<10, Rcpp::PreserveStorage>::~Vector (this=0x555560a72440, __in_chrg=<optimized out>)
    at /usr/lib/R/site-library/Rcpp/include/Rcpp/vector/Vector.h:28

@mattfidler
Copy link
Member

These models calculate the lhs correctly:

> babel.db$babelmixr2$modelMT
rxode2 NA model named rx_9039cf95c5540149d4bcde9607d1ce7e model (✔ ready).
$params: rx__tV, rx__tKa, rx__tCl, rx__eta.v, rx__eta.ka, rx__eta.cl, TAU, DOSE, rxXt_1, rxXt_2, rxXt_3, rxXt_4, rxXt_5
$lhs: rx_pred_, rx_r_
> summary(babel.db$babelmixr2$modelMT)
rxode2 NA model named rx_9039cf95c5540149d4bcde9607d1ce7e model (✔ ready).
DLL: /tmp/RtmpHOcu8A/rxode2/rx_9039cf95c5540149d4bcde9607d1ce7e__.rxd/rx_9039cf95c5540149d4bcde9607d1ce7e_.so
NULL

Calculated Variables:
[1] "rx_pred_" "rx_r_"
── rxode2 Model Syntax ──
rxode2({
    param(rx__tV, rx__tKa, rx__tCl, rx__eta.v, rx__eta.ka, rx__eta.cl,
        TAU, DOSE, rxXt_1, rxXt_2, rxXt_3, rxXt_4, rxXt_5)
    V ~ rx__tV * exp(rx__eta.v)
    KA ~ rx__tKa * exp(rx__eta.ka)
    CL ~ rx__tCl * exp(rx__eta.cl)
    Favail ~ 0.9
    N ~ floor(t/TAU) + 1
    y ~ (DOSE * Favail/V) * (KA/(KA - CL/V)) * (exp(-CL/V * (t -
        (N - 1) * TAU)) * (1 - exp(-N * CL/V * TAU))/(1 - exp(-CL/V *
        TAU)) - exp(-KA * (t - (N - 1) * TAU)) * (1 - exp(-N *
        KA * TAU))/(1 - exp(-KA * TAU)))
    rx_yj_ ~ 2
    rx_lambda_ ~ 1
    rx_low_ ~ 0
    rx_hi_ ~ 1
    rx_pred_f_ ~ y
    rx_pred_ = rx_pred_f_
    rx_r_ = (0.00223606797749979)^2 + (rx_pred_f_)^2 * (0.2)^2
    mtime(rxXt_1_v) ~ rxXt_1
    mtime(rxXt_2_v) ~ rxXt_2
    mtime(rxXt_3_v) ~ rxXt_3
    mtime(rxXt_4_v) ~ rxXt_4
    mtime(rxXt_5_v) ~ rxXt_5
})
> summary(babel.db$babelmixr2$modelF)
rxode2 NA model named rx_4726b1274f5b3a8bea20f8e946050017 model (✔ ready).
DLL: /tmp/RtmpHOcu8A/rxode2/rx_4726b1274f5b3a8bea20f8e946050017__.rxd/rx_4726b1274f5b3a8bea20f8e946050017_.so
NULL

Calculated Variables:
[1] "rx_pred_" "rx_r_"
── rxode2 Model Syntax ──
rxode2({
    param(rx__tV, rx__tKa, rx__tCl, rx__eta.v, rx__eta.ka, rx__eta.cl,
        TAU, DOSE)
    V ~ rx__tV * exp(rx__eta.v)
    KA ~ rx__tKa * exp(rx__eta.ka)
    CL ~ rx__tCl * exp(rx__eta.cl)
    Favail ~ 0.9
    N ~ floor(t/TAU) + 1
    y ~ (DOSE * Favail/V) * (KA/(KA - CL/V)) * (exp(-CL/V * (t -
        (N - 1) * TAU)) * (1 - exp(-N * CL/V * TAU))/(1 - exp(-CL/V *
        TAU)) - exp(-KA * (t - (N - 1) * TAU)) * (1 - exp(-N *
        KA * TAU))/(1 - exp(-KA * TAU)))
    rx_yj_ ~ 2
    rx_lambda_ ~ 1
    rx_low_ ~ 0
    rx_hi_ ~ 1
    rx_pred_f_ ~ y
    rx_pred_ = rx_pred_f_
    rx_r_ = (0.00223606797749979)^2 + (rx_pred_f_)^2 * (0.2)^2
})
>

@mattfidler
Copy link
Member

I haven't seen this before, I may be out of my depth here:

vex amd64->IR: unhandled instruction bytes: 0x7 0x0 0x0 0x0 0x0 0x58 0x80 0x72 0x1E 0x0
vex amd64->IR:   REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0
vex amd64->IR:   VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=NONE
vex amd64->IR:   PFX.66=0 PFX.F2=0 PFX.F3=0
==14801== Invalid read of size 1
==14801==    at 0x1E7280E8: ???
==14801==    by 0x1C938ED0: popedSolveIdME2(Rcpp::Vector<14, Rcpp::PreserveStorage>&, Rcpp::Vector<14, Rcpp::PreserveStorage>&, Rcpp::Vector<14, Rcpp::PreserveStorage>&, Rcpp::Vector<13, Rcpp::PreserveStorage>&, int, int, int) (poped.cpp:624)
==14801==    by 0x1C91E605: _babelmixr2_popedSolveIdME2 (RcppExports.cpp:139)
==14801==    by 0x4958237: ??? (in /usr/lib/R/lib/libR.so)
==14801==    by 0x495888C: ??? (in /usr/lib/R/lib/libR.so)
==14801==    by 0x49AFB97: Rf_eval (in /usr/lib/R/lib/libR.so)
==14801==    by 0x49B3237: ??? (in /usr/lib/R/lib/libR.so)
==14801==    by 0x49AF935: Rf_eval (in /usr/lib/R/lib/libR.so)
==14801==    by 0x49B16DE: ??? (in /usr/lib/R/lib/libR.so)
==14801==    by 0x49B24C6: ??? (in /usr/lib/R/lib/libR.so)
==14801==    by 0x49AF63B: Rf_eval (in /usr/lib/R/lib/libR.so)
==14801==    by 0x49B4751: ??? (in /usr/lib/R/lib/libR.so)
==14801==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==14801==

 *** caught segfault ***
address (nil), cause 'memory not mapped'

@mattfidler
Copy link
Member

It isn't the analytical solutions; its the switching between 2 poped databases. This should be fixed by #133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants