ImageMagick: convert quits after some pages

I try to convert some jpgs into one single pdf in using convert.

convert *.jpg new.pdf

But convert does quit after 18 pages. The output then is ok but not complete.

convert-im6.q16: DistributedPixelCache '127.0.0.1' @ error/distribute-cache.c/ConnectPixelCacheServer/244.
convert-im6.q16: cache resources exhausted `094708.JPG' @ error/cache.c/OpenPixelCache/3945.
...

I tried some limit settings but without success. If I try other jpgs then it is the same result.

Any ideas? I have plenty of free memory.

Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 
...
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib

Try to add the following option to increase the cache

convert -limit memory 1GiB -limit disk 1GiB *.jpg new.pdf

If it doesn't work set the limits into the image magic configuration file /etc/ImageMagick-6/policy.xml

<policy domain="resource" name="memory" value="256MiB"/>
<policy domain="resource" name="disk" value="1GiB"/>

to

<policy domain="resource" name="memory" value="3GB"/>
<policy domain="resource" name="disk" value="2GB"/>

and try it again