TIFF to PDF conversion in Rails using ImageMagick/MiniMagick on Heroku - ruby-on-rails-4

I am attempting to use the mini_magick GEM to convert TIFF files to PDF in Rails 4.2.6. The conversions work when testing in development but in production on the Heroku cedar-14 stack, they produce errors like the following:
convert /tmp/mini_magick20181121-5-11mxfxh /tmp/mini_magick20181121-5-6e3jp2.pdf` failed with error:
convert.im6: memory allocation failed `/tmp/mini_magick20181121-5-11mxfxh' # error/tiff.c/ReadTIFFImage/1268.
convert.im6: no images defined `/tmp/mini_magick20181121-5-6e3jp2.pdf' # error/convert.c/ConvertImageCommand/304
ImageMagick 6.7.7-10 2018-09-28 Q16
Features: OpenMP
GEM: mini_magick 4.9.2
Rails 4.2.6
UPDATE: The production server has TOO MUCH memory. When I run it with a 2.5 GB dyno, it fails. When I run it with a 1 GB dyno it works. I have duplicated this on the stage server as well. Increasing server memory causes it to fail with memory errors (very backwards!). I have tried adding environment variables MAGICK_MAP_LIMIT and MAGICK_MEMORY_LIMIT but they don't seem to have an effect. Also tried passing in -limit memory 200MB -limit map 200MB on the command line to no effect.

Related

Malloc error when trying to run node js server due to ibm_db module

I have a nodejs application, and configured to run on port 5001. When I try to run the node server using node server.js, it throws me an malloc error like below
node(6080,0x1067aa600) malloc: *** error for object 0x7ffb503d2670: pointer being freed was not allocated
node(6080,0x1067aa600) malloc: *** set a breakpoint in malloc_error_break to debug
zsh: abort node server.js
My machine configs are
Processor - 2.4 GHz 8-Core Intel Core i9
Memory - 32 GB 2667 MHz DDR4
When I try to run this server, I do not run any other node server. I also checked all the processes running but nothing clashes with it. Maybe I am missing something. I tried running it on different ports as well, but i get the same error
My node js version is v14.16.1
npm version is 6.14.12
Xcode version is 13.4.0.0.1.1651278267
The issue was not related with X code or node version but it was related to one the npm package I was using which was ibm_db and only if you have the mac monterey os.
Follow these step if you have this package installed to rectify the error.
Delete ibm_db package from your project and delete package-lock.json as well.
Install latest ibm_db package currently 2.8.1. Even if it does not resolve the error, do the last step.
Go to node_modules/ibm_db/installer/clidriver/lib and rename the file libstdc++.6.dylib to anything like libstdc++.7.dylib
You can find detailed discussion here
https://github.com/ibmdb/node-ibm_db/issues/824
https://github.com/ibmdb/node-ibm_db/issues/801
Hopefully the issue will be resolved. Thanks

Pabot - Unable to run parallel robotframework tests

So, I'm working on a robotframework test project, and the goal is to run several test suites in parallel. For this purpose, pabot was chosen as the solution. I am trying to implement it, but with little success.
My issue is: after installing Pabot (which, I might say, I did by cloning the project and running "setup.py install", instead of using pip, since the corporate proxy I'm behind has proven an obstacle I can't overcome), I created a new directory in the project tree, moved some suites there, and ran:
pabot --processes 2 --outputdir pabot_results Login*.robot
Doing so results in the following error message:
2018-10-10 10:27:30.449000 [PID:9676] [0] EXECUTING Suites.LoginAdmin
2018-10-10 10:27:30.449000 PID:400 EXECUTING Suites.LoginUser
2018-10-10 10:27:30.777000 PID:400 FAILED Suites.LoginUser
2018-10-10 10:27:30.777000 [PID:9676] [0] FAILED Suites.LoginAdmin
WARN: No output files in "pabot_results\pabot_results"
Output:
[ ERROR ] Reading XML source '' failed: invalid mode ('rb') or filename
Try --help for usage information.
Elapsed time: 0 minutes 0.578 seconds
Upon inspecting the stderr file that was generated, I have this message:
Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\robotframework-3.1a2.dev1-py2.7.egg\robot\running\runner.py", line 22, in
from .context import EXECUTION_CONTEXTS
ValueError: Attempted relative import in non-package
Apparently, this has to do with something from the runner.py script, which, if I'm not mistaken, came with the installation of robotframework. Since manually modifying that script does not seem to me the optimal solution, my question is, what am I missing here? Did I forget to do anything while setting this up? Or is this an issue of compatibility between versions?
This project is using Maven as the tool to manage dependencies. The version I am running is 3.5.4. I am using a Windows 10, 64bit system; I have Python 2.7.14, and Robot Framework 3.1a2.dev1. The Pabot version is 0.44. Obviously, I added C:\Python27 and C:\Python27\Scripts to the PATH environment variable.
Edit: I am also using robotframework-maven-plugin version 1.4.0.8, if that happens to be relevant.
Edit 2: added the error messages in text format.
I believe I've come across an issue similar when setting up parallel execution on my machine. Firstly I would confirm that pabot is installed using pip show robotframework-pabot.
Then you should define the directory your results are going to using -d.
I then modified the name of the -o to Output.xml to make it easy to identify.
This is a copy of the code I use. Runs optimally with 8 processes
pabot --processes 8 -d results -o Output.xml Tests
Seems that you stumbled on a bug in the prerelease version of robot framework (3.1a2.dev1).
Please install a release version of robot framework. For example 3.0.4.
Just in case anyone happens to stumble upon this issue in the future:
Since I can't use pip, and I tried a good deal of workarounds that eventually made things more unstable, I ended up saving my project and removing everything Python-related from my system, so as to allow me to install everything from scratch. In a Windows 10, 64bit system, I used:
Python 2.7.14
wxPython 2.8.12.1, win64, unicode, for py27
setuptools 40.2.0 (to allow me to use the easy_install command)
Robot Framework 3.0.4
robotremoteserver 1.1
Selenium2Library 3.0.0
and Pabot version 0.45.
I might add that, when installing the Selenium2Library the way I described above, it eventually tries to download some things from the pip repositories - which, if you have a proxy, will cause you trouble. I solved this problem by browsing https://pypi.org/simple/selenium/, manually downloading the 2.53.6 .tar.gz file, then extracting it and running setup.py install on the command line.
PS: Ideally, though, anyone should be able to use proxy settings from the command line (--proxy http://user:password#server:port) to get pip and then use it; however, for some reason, probably related to network security configurations that I didn't want to lose time with, this didn't work in my case.

Is dusk is mandatory to write phpunit test cases?how to write phpunit test cases in laravel 5.4?

I am newbie to laravel. I am using laravel 5.4 version, we have requirement of writing phpunit test cases for our application, So I have searched for writing phpunit testcases and also read the documentation in laravel website. I read about the 'dusk' feature for doing the browser tests. So, I have a doubt that is "Is the dusk is mandatory for writing the phpunit test cases in laravel 5.4? I also tried to install the 'dusk' package into our application but it is not getting installed after I run the command "composer require laravel/dusk".
below is the error that I am getting on command prompt:
c:\xampp\htdocs\ourappname>composer require laravel/dusk
using version ^1.1 for laravel/dusk
./composer.json has been updated
Loading composer repositories with package information
Updating dependies (including require-dev)
Package operations: 2 installs, 4 updates, 9 removals
- Removing maatwebsite/excel (2.1.17)
- Removing phpoffice/phpexcel (1.8.1)
- Removing jeremeamia/superclosure (2.3.0)
- Removing symfony/polyfill-php56 (v1.3.0)
- Removing symfony/polyfill-util (v1.3.0)
- Removing guzzlehttp/guzzle (6.2.3)
- Removing guzzlehttp/psr7 (1.4.2)
- Removing psr/http-message (1.0.1)
- Removing guzzlehttp/promises (v1.3.1)
- Updating psy/psysh (v0.8.3 => v0.8.5): Loading from cache
- Updating swiftmailer/swiftmailer (v5.4.7 => v5.4.8): Loading from cache
- Updating sebastian/diff (1.4.1 => 1.4.2): Loading from cache
- Updating laravel/framework (v5.4.21 => v5.4.23): Loading from cache
- Installing facebook/webdriver (1.4.1): Loading from cache
- Installing laravel/dusk (v1.1.0): Loading from cache
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Maatwebsite\Excel\ExcelServiceProvider' not found
Script php artisan optimize handling the post-update-cmd event returned with error code 1
Installation failed, reverting ./composer.json to its original content.
c:\xampp\htdocs\ourappname>
Anyone please tell me how to fix it? and also what is the process for writing the test cases in laravel 5.4? should we use 'dusk'? or any other way to do it? Thanks.
No, Dusk is not required to do unit testing. You can just use the basic tests.
Your error is related to when you installed the Excel package on your application; the Service Provider was added to your config/app.php, but now that you've removed the package from your application ("Removing maatwebsite/excel (2.1.17)") you also need to remove the Service Provider.

Rails 4 asset pipeline in production

My Rails app that I am upgrading to 4.2 from 3.2 has strange behavior in regards to the asset pipeline.
The guide says to use: RAILS_ENV=production bin/rake assets:precompile which causes this error:
Sass::SyntaxError: $red: "CC" is not a number for `rgba'
(sass):86
ArgumentError: $red: "CC" is not a number
The --trace doesn't point to any of my files and odder still is that I don't have any sass files to begin with.
I ran it without the RAILS_ENV and it compiled without complaint and everything seems to work.
My app has multiple layouts and themes which made for a slightly more complex and verbose set of asset manifests.
My question is, even though it seems to work is using that rake task without the RAILS_ENV=production going to cause issues?
It looks like you are actually sending an incorrect value to the sass compiler. Grep the code for $red or rgba and enter a correct list of numbers for the rgba statement that is causing the error.

How do I tell ColdFusion 9.0.1 to use a directory besides /tmp?

I installed ColdFusion 9.0.0 today and I'm trying to upgrade to 9.0.1.
Linux 64bit environment.
I don't have root access.
/tmp doesn't seem to have enough room to install 9.0.1
I found the following errors in /opt/coldfusion9/Adobe_ColdFusion_9.0.1_InstallLog.log
Install File: /tmp/515453.tmp/cf-multi-startup
Status: ERROR
Additional Notes: ERROR - ZeroGlq: No space left on device
Install File: /tmp/515453.tmp/cf-init.sh
Status: ERROR
Additional Notes: ERROR - ZeroGlq: No space left on device
I tried -D IATEMPDIR=/opt/temp, but installer says it's trying to use /home/coldfusion due to lack of space in /tmp. It tries to use /tmp anyway.
Any ideas?
Here's my final script that worked. I had to fill /tmp and /home to 100% to get a decent error response out of the bin file. I'm sure my Linux admins were very pleased.
cd /opt/coldfusion9/bin
IATEMPDIR=/home/coldfusion
export IATEMPDIR
LAX_DEBUG=1
export LAX_DEBUG
./ColdFusion_update_901_WWEJ_linux64.bin