Closed msquatrito closed 6 years ago
Sorry, I have no idea about this without a reproducible example.
Unfortunately I can't send you a reproducible example because I can't reproduce the error. Thanks anyway
On 15 Apr 2016, at 00:07, Yihui Xie notifications@github.com wrote:
Sorry, I have no idea about this without a reproducible example.
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub
I see this issue as well but it is sporadic and I am not sure what the root cause is. In the console it looks as if it calls the API and it timeouts.
Another user of my app (http://gliovis.bioinfo.cnio.es) has reported a similar problem. It's actually not when they try to download the data. The app does some processing and than it's suppose to return a table, but instead gives the error and gray out. It's not only one specific table. The error has occurred on different tables. The error has been only reported since I've updated to DT_0.1.55. I can't be sure if people have experienced the problem with a previous DT version.
@msquatrito Could you tell me the steps to reproduce the problem?
You can try in the Explore/Correlations/Corr-All tab. Type "EGFR" in the side "Gene" slot. You should see a table appearing in the main panel on the right. As I said, I cannot reproduce the problem my self, so I don't know if you'll experience any issue. Thank you so much to take some of your time to look into it.
@msquatrito Actually I can reproduce the problem. Do you have access to the Shiny Server log? I wonder what kind of error occurred on the server.
Dear Yihui,Here are the log files for the last weeks. I'm not familiar with them, so I don't exactly know where to look. I do see various errors, but none related to a renderDataTable call.Thanks.
I think you are right that the errors do not seem to be related to renderDataTable()
. Is it possible for you to share the source code of this app with me privately? yihui [at] rstudio.com
@msquatrito I tested it locally but could not reproduce the problem. There seems to be something wrong with your server, but I cannot figure out anything from the error message in the web browser or the server log.
Thanks anyway.
On 27 Apr 2016, at 07:03, Yihui Xie notifications@github.com wrote:
@msquatrito I tested it locally but could not reproduce the problem. There seems to be something wrong with your server, but I cannot figure out anything from the error message in the web browser or the server log.
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub
@yihui This issue has never occurred locally and seems to only happen when we deploy to shiny server.
@JackStat Are you able to come up with a minimal reproducible example? Does the problem also occur if you deploy the app to ShinyApps.io?
I have had users report a similar issue. It's very hard to reproduce and seems to happen randomly. Sometimes my app, deployed on shinyapps.io, will be fine for days, I haven't made any updates, but then a user will report this error. I've managed to reproduce it sometimes, not by doing anything different, just by using the app. I can say that I only seem to encounter the error when using Firefox. I've not had the problem in Chromium. Nothing appears in the shinyapps.io logs about this.
We are seeing the issue with Chrome as well and yes I haven't been able to reproduce the issue. I thought timing out the datatable was the issue but that didn't seem to matter.
I am getting this error again randomly... It seemed like it was under control for a bit. I see this in the console
Failed to load resource: the server responded with a status of 404 (Not Found)
With this url information
_w_d5f0a5979f1b6df6289b70b31dc46fa72695a0e818e8d23f/session/2307db7c2ea9387a0b8a653df6596b99/dataobj/dTab?w=d5f0a5979f1b6df6289b70b31dc46fa72695a0e818e8d23f
and dTab
is a datatable object in my shiny app
Another view on it. I am getting 404s when this error pops up
Something similar also occurs now after upgrading DT
Only occurs when using shiny-server, not when running the shiny app using RStudio.
jquery.min.js:4 POST http://crispr-analyzer.dkfz.de/session/db91254a2db6a058213744ffdc750dec/dataobj/idSGRNAtargets?w= 500 (Internal Server Error)send @ jquery.min.js:4ajax @ jquery.min.js:4ra @ VM389:36lb @ VM389:37O @ VM389:29T @ VM389:31ga @ VM389:48(anonymous function) @ VM389:93each @ jquery.min.js:2each @ jquery.min.js:2m @ VM389:82h.fn.DataTable @ VM389:166renderValue @ datatables.js:210shinyBinding.renderValue @ htmlwidgets.js:508onValueChange @ output_binding.js:16delegator.(anonymous function) @ htmlwidgets.js:112onValueChange @ output_binding_adapter.js:21receiveOutput @ shinyapp.js:257(anonymous function) @ shinyapp.js:424_sendMessagesToHandlers @ shinyapp.js:409dispatchMessage @ shinyapp.js:393c.onmessage @ shinyapp.js:91MultiplexClient.onConnMessage @ shiny-server.js:445conn.onmessage @ shiny-server.js:402d.dispatchEvent @ sockjs-0.3.4.min.js:27y._dispatchMessage @ sockjs-0.3.4.min.js:27y._didMessage @ sockjs-0.3.4.min.js:27b.onmessage @ sockjs-0.3.4.min.js:27d.dispatchEvent @ sockjs-0.3.4.min.js:27c.xo.onchunk @ sockjs-0.3.4.min.js:27f.emit @ sockjs-0.3.4.min.js:27g.xhr.onreadystatechange @ sockjs-0.3.4.min.js:27
@jwinter6 Could you tell me the steps to reproduce the problem?
Encounter the same error, but locally when I use Rstudio (not when I use Shiny server).
At the meanwhile, I receive the Error messages as below.
Warning: Error in vapply: values must be length 4,
but FUN(X[[2]]) result is length 1
Stack trace (innermost first):
1: runApp
Error in vapply(x, asJSON, character(nrow(x)), collapse = FALSE, complex = complex, :
values must be length 4,
but FUN(X[[2]]) result is length 1
After scrolling back to version 0.1, this error is gone.
Hope this would be helpful.
@XD-DENG Could you provide a minimal, self-contained, and reproducible example?
@yihui Hi Yihui, as requested, I have prepared an single-file Shiny app as the example.
library(shiny)
library(DT)
library(shinydashboard)
server <- function(input, output, session) {
# The data used for DT will be a reactive object --------------------------------------
dat_for_DT <- reactive({
if(input$data_to_use == "dat_1"){
# [Data - 1] --------------------------
temp <- tapply(iris$Sepal.Length, iris$Species, mean)
result <- data.frame(species = names(temp),
mean = temp)
return(result)
}
if(input$data_to_use == "dat_2"){
# [Data - 2] --------------------------
iris[1:5, ]
}
})
# Render the DT datatable ----------------------------------------------------------
output$business_report_table_key_fact <- DT::renderDataTable({
print(dat_for_DT()) # print the data used
print(class(dat_for_DT())) # print the class of the data used
print(dim(dat_for_DT())) # print the dimension of the data used
DT::datatable(dat_for_DT(),
escape = FALSE,
rownames = FALSE,
options = list(dom = 'tip')
)
})
}
ui <- dashboardPage(
dashboardHeader(title = "Testing"),
dashboardSidebar(
sidebarMenu(
menuItem("Testing", tabName = "testing", icon = icon("user"))
)
),
dashboardBody(
tabItem(tabName = "testing",
box(title = "Testing", status = "primary", solidHeader = TRUE, width = 12,
selectInput("data_to_use",
label = "Choose data for DT",
choices = c("dat_1", "dat_2"),
selected = "dat_2"),
div(DT::dataTableOutput("business_report_table_key_fact"), style="align:center")
)
)
)
)
shinyApp(ui = ui, server = server)
When we choose dat_2
, it's using the iris
data frame and the app works well.
When we choose dat_1
, the data used for DT will be a data frame generated by aggregating using tapply
temp <- tapply(iris$Sepal.Length, iris$Species, mean)
result <- data.frame(species = names(temp),
mean = temp)
return(result)
in which case we will get error.
PS R: 3.3.1 shiny: 0.13.2 DT: 0.2 shinydashboard: 0.5.1
NOTE
When I use version 0.1 of DT
, I do NOT encounter this error.
I tried the dev version 0.2.3 of DT
on Github, will get the same error as version 0.2
Hi, thanks for sharing the working example, I was on holidays and now I am glad I don't need to provide a working example ;) I see exactly the same, using the same versions of R, shiny , shinydashboard and DT. The older version 0.1 of DT also does not give any error for me.
@jwinter6 Thanks for help double-checking on the example ;-)
Based on the error message I received in console
Error in vapply(x, asJSON, character(nrow(x)), collapse = FALSE, complex = complex, :
I would suspect the error arose from the dependency jsonlite
@yihui @jwinter6 To follow up with the example I've given above,
The error is gone when I use
temp <- tapply(iris$Sepal.Length, iris$Species, mean)
result <- data.frame(species = names(temp),
mean = as.numeric(temp))
return(result)
instead of
temp <- tapply(iris$Sepal.Length, iris$Species, mean)
result <- data.frame(species = names(temp),
mean = temp)
return(result)
The main difference is whether the column mean
has additional attribution, dimension. This is what caused the error.
But it's still weird given version 0.1 of DT works perfectly on both.
@XD-DENG @yihui I just explicitly made as.numeric() to all numeric columns within my data.frame (though they are already numeric when I do str()) and the problem is gone. I have no idea why, but for me it is fixed :) Thanks a lot @XD-DENG for this hint !!! Cheers Jan
Excellent! Much appreciated for the minimal reproducible example! @XD-DENG I just pushed a fix to the current development version. You are right about the reason: temp
is an array with a single dimension (also with names), and if you flatten it into a normal vector (as.numeric()
), the problem will be gone. DT will do that automatically now.
Hi @yihui , no worries. I'm more than happy that I could contribute a bit.
I have tried the latest dev version and it works perfectly here. Thanks for your prompt response.
I hit the same error, running code very similar to @XD-DENG. I just installed the dev version but still hit the error. I'm using data_frame instead of data.frame. Adding as.numeric to my numeric columns fixes the problem.
@grasshoppermouse Could you provide a minimal, self-contained, and reproducible example?
library(shiny)
library(DT)
ui <- shinyUI(navbarPage(
title = 'Test',
tabPanel(
"Groups",
sidebarPanel(
htmlOutput("groupSelectUI"),
actionButton('groupStats', 'Group means')
),
mainPanel(DT::dataTableOutput('groupStats'))
)
))
server <- function(input, output, session) {
mean_group <- function(df, var){
df$id <- rownames(df)
submatrix_mean <- function(g){
ids <- df[['id']][df[[var]] == g] # ids in group g
mean(df[['Sepal.Length']][df$id %in% ids ])
}
unique_groups <- table(df[[var]])
group_means <- sapply(names(unique_groups), FUN = submatrix_mean)
df_group <- data_frame(
`Group id` = names(unique_groups),
`Group size` = unique_groups, #as.numeric(unique_groups),
`Mean` = group_means #as.numeric(group_means)
)
return(df_group)
}
group_means <- eventReactive(input$groupStats, {
mean_group(
iris, 'Species'
)
})
output$groupStats <- DT::renderDataTable(group_means(),
options = list(
scrollY = '75vh',
scrollX = TRUE,
paging = FALSE
))
}
shinyApp(ui = ui, server = server)
@grasshoppermouse Should be fixed now. Thanks for the report!
For whatever it may be worth. I had the same problem. It happened because I deployed two shiny applications in Windows 10. I needed to completely force-close RStudio from task manager before executing the second app. After this, the DT table load well.
Hi, An user of one of our Shiny app is getting "table id=datatables_table_0 - ajax error" when tries to download the data of a DT table that use the extension "Buttons". He's getting this error using different browsers, but we cannot reproduce the issue from our side. Do you have any clue what could be causing this kind of error? Could it be the network configuration of the user? Thanks in advance for your help. Best, Massimo