Jffs2 vs ext4 overlay, strange behaviour

I am trying to run greengrass core application on OpenWRT.
Daemon starts. but any attempt to deploy a function to it ends with panic state and application kills all its workers.
This is how the application behaves when /overlay is mounted on mtd partition (default system's configuration). But when I put /overlay on extroot (pendrive with ext4) the application works.

It seems that file permissions, attributes and owners are the same on both partitions.
Sometimes there is an error from sqlite:

SQLite error: Failed to Exec PRAGMA journal_mode: disk I/O error

and it is the only error message with some useful information.
Any idea what is going on here? How to debug it?

Tested on LEDE 17.01 and OpenWRT 18.06.

opkg update; opkg install strace
strace -e trace=file -o /tmp/strace.log YOURPROGRAM
cat /tmp/strace.log | more

I don't see anything helpful in log, but I examined the disk I/O error.

Does JFFS2 support MMAP_SHARED? What about UBIFS

Is there enough free space on the device?

Yes it is. I've got ~1GB free.

But it must be mmap:

SQLite version 3.21.0 2017-10-24 18:55:49
Enter ".help" for usage hints.
sqlite> .log stdout
sqlite> create table test (test integer); 
sqlite> .tables
sqlite> pragma journal_mode=wal;
sqlite> .tables
(5386) os_unix.c:34923: (22) mmap(/root/testdb-shm) - Invalid argument
(5386) statement aborts at 24: [SELECT name FROM "main".sqlite_master  WHERE type IN ('table','view')   AND name NOT LIKE 'sqlite_%'   AND name LIKE ?1 ORDER BY 1] disk I/O error
Error: disk I/O error

After a quick Google search, I would say it doesn't...

I created separated ubifs partition and now this application works. But it has two modes of operation and I started the simplest one (running as a root).
I would like to run it in a container, but I am getting an error

starting container process caused "process_linux.go:345: container init caused \"rootfs_linux.go:62: mounting \\\"proc\\\" to rootfs \\\"/usrdata/greengrass/ggc/packages/1.7.0/rootfs/merged\\\" at \\\"/proc\\\" caused \\\"operation not permitted\\\"\

Do you know if this error is related to nesting overlay partitions (openwrt has already overlayfs on /) or is it something directly related to /proc?
I tried to remount proc:

mount -o remount,rw,relatime /proc

but mount point didn't change.

My mount points:

dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
cgroup on /sys/fs/cgroup type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset,cpu,cpuacct,blkio,memory,devices,freezer,net_cls,perf_event,net_prio,pids,debug)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/mtdblock7 on /overlay type jffs2 (rw,noatime)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
/dev/mtdblock5 on /mnt type jffs2 (rw,relatime)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
ubi0:usrdata on /usrdata type ubifs (rw,relatime)