# Bad gateway. Help needed

**URL:** <https://datashield.discourse.group/t/bad-gateway-help-needed/362>\
**Category:** Developer support\
**Created:** [19 February 2021 12:01 UTC](https://datashield.discourse.group/t/bad-gateway-help-needed/362 "2021-02-19T12:01:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![xescriba](https://avatars.discourse-cdn.com/v4/letter/x/ee59a6/32.png) [@xescriba](https://datashield.discourse.group/u/xescriba)\
**Post date:** [19 February 2021 12:01 UTC](https://datashield.discourse.group/t/bad-gateway-help-needed/362/1 "2021-02-19T12:01:04Z")

</div>

Hello!

I’m getting a bad gateway error that I can’t solve. On the Opal R log I can see that my function is running, however when the return line is interpreted, a 502 error occurs.

A reproducible example:

```
require('DSI')
require('DSOpal')
library(dsBaseClient)
library(dsOmicsClient)

builder <- newDSLoginBuilder()
builder$append(server = "study1", url = "https://opal-demo.obiba.org", 
               user = "dsuser", password = "password", 
               resource = "RSRC.tcga_liver")

logindata <- builder$build()

conns <- datashield.login(logins = logindata, assign = TRUE, 
                          symbol = "res")

datashield.assign.expr(conns = conns, symbol = "rse", expr = quote(as.resource.object(res)))

ans.gender <- ds.limma(model = ~ gdc_cases.demographic.gender, 
                       Set = "rse", type.data = "RNAseq", 
                       sva = FALSE)
deseq_ds = ds.DESeq2(model = ~ gdc_cases.demographic.gender, set = "rse")

```

On this example (when I run it) the ds.limma returns a table while the ds.DESeq2 returns a 502 error. Both functions are called using the same structure, so I can’t understand why one works and the other does not. The code for them can be found at

> <https://github.com/isglobal-brge/dsOmics/blob/master/R/DESeq2DS.R>

> <https://github.com/isglobal-brge/dsOmics/blob/master/R/edgeRDS.R>

Thanks for your time,

Xavier

---

<div class="post-metadata">

**Author:** ![tombishop](https://yyz2.discourse-cdn.com/free1/user_avatar/datashield.discourse.group/tombishop/32/23_2.png) [@tombishop](https://datashield.discourse.group/u/tombishop)\
**Post date:** [19 February 2021 13:10 UTC](https://datashield.discourse.group/t/bad-gateway-help-needed/362/2 "2021-02-19T13:10:07Z")

</div>

Hi Xavier, in my experience this type of error happens when the server is overloaded. In my local machine using DESeq2 is a lot more intensive than limma. Limma runs OK, but the equivalent DESeq2 command on the same data causes a crash. The error is different though - I get a connection refused message

---

<div class="post-metadata">

**Author:** ![xescriba](https://avatars.discourse-cdn.com/v4/letter/x/ee59a6/32.png) [@xescriba](https://datashield.discourse.group/u/xescriba)\
**Post date:** [19 February 2021 14:04 UTC](https://datashield.discourse.group/t/bad-gateway-help-needed/362/3 "2021-02-19T14:04:45Z")

</div>

Those are unfortunate news, thanks for the response.

---

<div class="post-metadata">

**Author:** ![yannick](https://yyz2.discourse-cdn.com/free1/user_avatar/datashield.discourse.group/yannick/32/19_2.png) [@yannick](https://datashield.discourse.group/u/yannick)\
**Post date:** [19 February 2021 14:51 UTC](https://datashield.discourse.group/t/bad-gateway-help-needed/362/4 "2021-02-19T14:51:56Z")

</div>

Hi Xavier,

It is time for you to get your own development server 🙂 opal-demo is not meant for heavy loads.

Best  
Yannick

---

<div class="post-metadata">

**Author:** ![xescriba](https://avatars.discourse-cdn.com/v4/letter/x/ee59a6/32.png) [@xescriba](https://datashield.discourse.group/u/xescriba)\
**Post date:** [19 February 2021 15:07 UTC](https://datashield.discourse.group/t/bad-gateway-help-needed/362/5 "2021-02-19T15:07:17Z")

</div>

Yes, definitely I will have to look into getting a development server. Do you think it’s possible to develop some sort of check / error formatting that catches this types of crashes? I got really frustrated not understanding the source of my error.

---

<div class="post-metadata">

**Author:** ![yannick](https://yyz2.discourse-cdn.com/free1/user_avatar/datashield.discourse.group/yannick/32/19_2.png) [@yannick](https://datashield.discourse.group/u/yannick)\
**Post date:** [19 February 2021 15:55 UTC](https://datashield.discourse.group/t/bad-gateway-help-needed/362/6 "2021-02-19T15:55:19Z")

</div>

The problem is that R eats all the memory and opal has no room to react/reply. One option is to have distinct servers, one for opal, another one for R.

Yannick

---

<div class="post-metadata">

**Author:** ![yannick](https://yyz2.discourse-cdn.com/free1/user_avatar/datashield.discourse.group/yannick/32/19_2.png) [@yannick](https://datashield.discourse.group/u/yannick)\
**Post date:** [20 February 2021 13:28 UTC](https://datashield.discourse.group/t/bad-gateway-help-needed/362/7 "2021-02-20T13:28:47Z")

</div>

By the way, if the your DS aggregation task takes a long time to run, have a try to the dev version of DSI:

```auto
remotes::install_github("datashield/DSI")
remotes::install_github("datashield/DSOpal")
remotes::install_github("datashield/DSLite")

```

it might help.

Regards  
Yannick
