2

I've got a strange problem with opencpu. I'am setting up a webinterface to use xcms (R-package) and when reading an mzxml file with the webinterface I get the error : cannot allocate vector of size 207.2 Mb. This looks like an error from R, but if I open R on the server and try to open the file myself it works and R creates and object of 435Mb. Is there somewhere a memory limit set (apache, opencpu, R)? If I use ulimit -a the max memory size is set to unlimited.

Cheers, Rico

ricoderks
  • 1,619
  • 9
  • 13
  • This is indeed an R error and it means that there isn't sufficient RAM available to allocate **additional** 207 MB. Keep in mind that R keeps everything in RAM and all operations on an object require additional memory. Reading the data and creating the final object might need (much) more memory than the final object size. Are you sure that using your webinterface you did the exact same operations as when using R directly? – Roland Nov 29 '13 at 09:47
  • Hi Roland, yes I'am using the same library and I also use the same function (xcmsRaw). In both cases I use the same default parameters. – ricoderks Nov 29 '13 at 10:22
  • Well, how much memory does you webinterface use? You need to profile RAM usage. – Roland Nov 29 '13 at 10:32

1 Answers1

2

Yes, the OpenCPU cloud server sets a memory limit RLIMIT_AS on every request using the RAppArmor package. This is to prevent a single user from consuming all resources on a server. The default limit is 1GB per process. You can configure these limits by editing:

/etc/opencpu/server.conf

After editing the file, restart the server:

sudo service opencpu restart

For more information on rlimits, read the JSS paper on RAppArmor.

Jeroen Ooms
  • 31,998
  • 35
  • 134
  • 207
  • Hi Jeroen, thanks that did the job. I also upgrade my virtual machine to a 64bit system. Colleagues working a lot with XCMS noticed that with large mzxml files R cannot use enough memory. I also tried to profile my memory usage (as @Roland suggested), but there was not much difference between just using R or doing everything through the webinterface. I used free for this and saw that doing everything through the webinterface used approx. 30Mb more. Cheers, RICO – ricoderks Dec 02 '13 at 07:29