R error SQLSatellite cannot read data chunk - r

I have an SSIS 2015 package that calls a Stored Proc in SQL Server 2016.
When I run the SSIS package I get these two messages:
Error: A 'R' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004.
Error: STDERR message(s) from external script:
Error in eval(expr, envir, enclos) : bad allocation
Calls: source -> withVisible -> eval -> eval -> .Call
Execution halted
So I ran the stored proc in SSMS but get these messages.
A 'R' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004.
STDERR message(s) from external script:
SqlSatellite cannot read data chunk. Error code:0x80004004.
Error in eval(expr, envir, enclos) : SqlSatellite cannot read data chunk. Error code:0x80004004.
Calls: source -> withVisible -> eval -> eval -> .Call
I have run the R scripts input query in SSMS which returns data, I do not believe I am missing any columns in the R script which I believe was working previously.
But being new to R I have no idea how to diagnose what may be causing the problem.

I did some more research on the errors and found some information at http://www.nielsberglund.com/2017/11/11/microsoft-sql-server-r-services-internals-xiii/.
The suspicion was that it may not be a code issue, more a data issue. A considerable amount of testing indicated it was the amount of data I was analyzing with the R script, I was able to restrict the amount of data using some date parameters and finished the data loads.
Hope this helps others.

I had the same error using Python in SQL Server 2017. I figured out it was because my WITH RESULT SETS statement did not fit my OutputDataSet.

Related

How to stop R shiny session or R script without stack trace?

I have complex code and I have two withCallingHandlers that handle errors. and I want to call stop() to stop R or shiny session but I have a long stacktrace. I've tried:
invokeRestart("abort")
but then I've got error:
Error in execCallbacks(timeoutSecs, all, loop$id) :
Calls: <Anonymous> ... ..stacktracefloor.. -> serviceApp -> service -> run_now -> execCallbacks
Execution halted
is it possible to stop R without stack trace? Note that I can't call quit(), since this will stop all shiny sessions.

Negative binomial regression in R using brm causing error when using multiple cores

I am calculating a negative binomial regression using the brm function from the brms package. As this takes quite some time, I would like to use multiple cores as suggested in the documentation.
bfit_s <- brm(
dep_var ~ ind_var +
var1 +
var2 +
(1 | some_level1) + (1 | some_level2),
data = my_df,
family = negbinomial(link = "log", link_shape = "log"),
cores = 4,
control = list(adapt_delta = 0.999)
)
However, I am running into an error saying that the connection of all four workers failed:
Compiling the C++ model
Start sampling
starting worker pid=11603 on localhost:11447 at 14:13:56.193
starting worker pid=11601 on localhost:11447 at 14:13:56.193
starting worker pid=11602 on localhost:11447 at 14:13:56.198
starting worker pid=11604 on localhost:11447 at 14:13:56.201
Error in unserialize(node$con) : error reading from connection
Calls: <Anonymous> -> slaveLoop -> makeSOCKmaster
Error in unserialize(node$con) : error reading from connection
Calls: <Anonymous> -> slaveLoop -> makeSOCKmaster
Error in unserialize(node$con) : error reading from connection
Calls: <Anonymous> -> slaveLoop -> makeSOCKmaster
Execution halted
Execution halted
Execution halted
Error in unserialize(node$con) : error reading from connection
Calls: <Anonymous> -> slaveLoop -> makeSOCKmaster
Execution halted
The traceback says Error in makePSOCKcluster(names = spec, ...) : Cluster setup failed. 4 of 4 workers failed to connect.
I tried to understand the problem, read some questions on SO like this, but couldn't figure out why I can't connect. I'm using macOS Mojave and the problem is not that I try to use more cores than possible. Any suggestions on how I could get this to run on multiple cores?
Edit:
As sjp pointed out in his answer, there is an issue with RStudio. I thought I share the code to solve the problem right here in my question, so everyone stumbling across can solve this without clicking (and reading) any further.
The problem is the parallel package from R-4.0.0. - but a workaround is provided by a user from this stan forum. If you can initialize clusters with setup_strategy="sequential" like this:
cl <- parallel::makeCluster(2, setup_strategy = "sequential")
You can add a short snippet to your ~/.Rprofile to make this kind of a default setting:
## WORKAROUND: https://github.com/rstudio/rstudio/issues/6692
## Revert to 'sequential' setup of PSOCK cluster in RStudio Console on macOS and R 4.0.0
if (Sys.getenv("RSTUDIO") == "1" && !nzchar(Sys.getenv("RSTUDIO_TERM")) &&
Sys.info()["sysname"] == "Darwin" && getRversion() == "4.0.0") {
parallel:::setDefaultClusterOptions(setup_strategy = "sequential")
}
This is a known issue that has to do with RStudio. Check out these related posts on the Stan forums and Github.
Github: https://github.com/rstudio/rstudio/issues/6692
Stan forums: https://discourse.mc-stan.org/t/r-4-0-0-and-cran-macos-binaries/13989/13

Unable to run markdown - error for code with ggplot

I was trying out a set of codes from the book R for Data Science, which seem to be running perfectly fine in the console. However , when I try to compile it as a markdown, I'm unable to proceed & am getting the following error :
Error in -title: invalid argument to unary operator Calls: ... handle -> withCallingHandlers -> withVisible -> eval -> eval Execution halted

Unable to Knit HTML /PDF/Word in R Studio(Version 0.98.1103). Encountering "Execution Halted"

I was working on R markdown documents in R studio, and I had knit the HTML, PDF and Word. It had worked fine.
Then when I tried to publish it online I encountered an error
" Error in function (type, msg, asError = TRUE) : SSL certificate problem: unable to get local issuer certificate Calls: rpubsUpload ... -> .postForm -> .Call -> -> fun Execution halted"
To solve which I had found a solution at " https://support.rstudio.com/hc/en-us/articles/205002917-SSL-certificate-problem-when-publishing-to-RPubs" which suggested running the command
file.edit('~/.Rprofile') within RStudio
and inserting the following code:
options(rpubs.upload.method = "internal" .
But after doing the above, I have not been able to knit any thing in R Studio.
Every time I click Knit button I keep encountering
"Error: could not find function "file.edit"
Execution halted"
How can I resolve this and get things to work?
I have finally found the solution. I simply found where my .Rprofile was and deleted it. It solved my problem.

The app is disconnected after a second

I ran shiny app in linux.
I open the browser in the url: http://192.241.147.231:4949/sample-apps/MonitorUI/
The page is open but after a second disconnected.
I check the log file and it write to me this massage:
Error in eval(expr, envir, enclos) :
You are attempting to load an rmarkdown file, but the
rmarkdown package was not found in the library. Ensure that
rmarkdown is installed and is available in the Library of the
user you're running this application as.
Calls: local -> eval.parent -> eval -> eval -> eval -> eval
Execution halted
I already downloaded the "rmarkdown" package. and it updated.
What is the problem? i don't find anything for this problem in the web.
the sample app that given by shiny-server package:http://192.241.147.231:4949/sample-apps/hello/ is working so what is the problem?
Thanks.

Resources