Re: race-condition in ram_fs and fs_query?

2019-05-20 Thread Guido Witmond

Hi All,

Reading release-notes 18.08 it states that RAM_FS and VFS are supposed 
to be equal.


However, I don't get any errors when I replace my ram_fs config with 
this vfs:





  








It perfectly reports the filename and contents in the report_rom. :-)



Now the next step: create a dynamic ROM to start the pdf_view component 
on demand. Any pointers to run files that help me get going?


Cheers, Guido.



On 5/20/19 1:27 PM, Guido Witmond wrote:

Hi Genodians,

I'm working on my HnH19-project to create a component listening on a 
shared filesystem to open each pdf file into a separate instance of 
mupdf. Goal is to tie the share to a linux-vm in vbox so firefox and 
thunderbird can have a simple 'cp' command to get pdfs rendered outside 
that vm.


I add a RAM-FS, FS-QUERY and REPORT-ROM to mupdf.run. The file gets put 
in the ram-fs, fs-query should pick that up and report it to the 
report-rom.


     
     
     
       
     
     
     
     

     
     
     
    


     
     

     
     
     
       
     
     
     

I change the test-scenario to copy a pdf into the share and start the 
pdf-viewer. The viewer picks up the pdf and renders it. So far so good.



The problem is that while the 'add'-test copies the file, it gets 
detected by fs_query but fs_query thinks it's gone:


[init -> test -> add] --- noux started ---
[init -> fs_query] Error: failed to watch '//foo.pdf'
[init -> fs_query] Warning: could not obtain content of nonexistent file 
foo.pdf


(The error comes from gems/vfs.h L556, the warning from fs_query/main.cc 
L80.)


Fs_quey does send a new report but does not show the file, it show an 
empty directory.


[init -> report_new_pdf] report 'fs_query -> listing'
[init -> report_new_pdf]   
[init -> report_new_pdf]    
[init -> report_new_pdf]   

However, a ls -laR shows it's there:

[init -> test -> ls-after] /dest:
[init -> test -> ls-after] total 1
[init -> test -> ls-after] drwxr-xr-x 0 root 0    0 Jan  1 00:00 .
[init -> test -> ls-after] drwxr-xr-x 0 root 0    0 Jan  1 00:00 ..
[init -> test -> ls-after] -rwxrwxrwx 0 root 0 8192 Jan  1 00:00 foo.pdf


Now the race condition:

When I set the fs-query option to show the content to "no", it gives the 
same error: failed to watch '//foo.pdf' but it now it does send the file 
name to the report:


[init -> report_new_pdf]    


So it seems that somehow that fs_query watch learns there is a file 
while the contents are not yet committed. Accessing that triggers a 
file-not-found error.


Did I discover a race condition or am I doing something wrong?


With regards, Guido.

PS. I added the complete run-file and logs for completeness. (log-1 
shows the contents-flag to no).

PPS. I'm testing with Qemu in a linux VM on my AMD nixos host.

___
Genode users mailing list
users@lists.genode.org
https://lists.genode.org/listinfo/users




___
Genode users mailing list
users@lists.genode.org
https://lists.genode.org/listinfo/users

race-condition in ram_fs and fs_query?

2019-05-20 Thread Guido Witmond

Hi Genodians,

I'm working on my HnH19-project to create a component listening on a 
shared filesystem to open each pdf file into a separate instance of 
mupdf. Goal is to tie the share to a linux-vm in vbox so firefox and 
thunderbird can have a simple 'cp' command to get pdfs rendered outside 
that vm.


I add a RAM-FS, FS-QUERY and REPORT-ROM to mupdf.run. The file gets put 
in the ram-fs, fs-query should pick that up and report it to the report-rom.





  








   








  




I change the test-scenario to copy a pdf into the share and start the 
pdf-viewer. The viewer picks up the pdf and renders it. So far so good.



The problem is that while the 'add'-test copies the file, it gets 
detected by fs_query but fs_query thinks it's gone:


[init -> test -> add] --- noux started ---
[init -> fs_query] Error: failed to watch '//foo.pdf'
[init -> fs_query] Warning: could not obtain content of nonexistent file 
foo.pdf


(The error comes from gems/vfs.h L556, the warning from fs_query/main.cc 
L80.)


Fs_quey does send a new report but does not show the file, it show an 
empty directory.


[init -> report_new_pdf] report 'fs_query -> listing'
[init -> report_new_pdf]   
[init -> report_new_pdf]
[init -> report_new_pdf]   

However, a ls -laR shows it's there:

[init -> test -> ls-after] /dest:
[init -> test -> ls-after] total 1
[init -> test -> ls-after] drwxr-xr-x 0 root 00 Jan  1 00:00 .
[init -> test -> ls-after] drwxr-xr-x 0 root 00 Jan  1 00:00 ..
[init -> test -> ls-after] -rwxrwxrwx 0 root 0 8192 Jan  1 00:00 foo.pdf


Now the race condition:

When I set the fs-query option to show the content to "no", it gives the 
same error: failed to watch '//foo.pdf' but it now it does send the file 
name to the report:


[init -> report_new_pdf]


So it seems that somehow that fs_query watch learns there is a file 
while the contents are not yet committed. Accessing that triggers a 
file-not-found error.


Did I discover a race condition or am I doing something wrong?


With regards, Guido.

PS. I added the complete run-file and logs for completeness. (log-1 
shows the contents-flag to no).

PPS. I'm testing with Qemu in a linux VM on my AMD nixos host.
including /home/guido/genode/tool/run/power_on/qemu
including /home/guido/genode/tool/run/log/qemu
including /home/guido/genode/tool/run/image/iso
including /home/guido/genode/tool/run/boot_dir/nova
including /home/guido/genode/repos/mupdf-gw/run/mupdf-gw.run
building targets:  app/pdf_view server/ram_fs app/fs_query app/sequence 
spawn make app/pdf_view server/ram_fs app/fs_query app/sequence
make[1]: Entering directory '/home/guido/genode/build/qemu_x86_64'
checking library dependencies...
  Library ldso-startup
  Library libc-stdlib
  Library libc-string
  Library libc-locale
  Library libc-inet
  Library libc-stdio
  Library libc-stdtime
  Library libc-gdtoa
  Library libc-regex
  Library libc-gen
  Library libc-setjmp
  Library libc-compat
  Library libc-mem
  Library libc-resolv
  Library libc-nameser
  Library libc-isc
  Library mupdf_host_tools
  Library ld
  Library libc-rpc
  Library libc-net
  Library base
  Program app/sequence/sequence
  Program server/ram_fs/ram_fs
  Library vfs
  Program app/fs_query/fs_query
  Library libc
  Library zlib
  Library jpeg
  Library freetype
  Library libm
  Library libpng
  Library openjpeg
  Library jbig2dec
  Library mupdf
  Program app/pdf_view/pdf_view
make[1]: Leaving directory '/home/guido/genode/build/qemu_x86_64'
genode build completed
checking configuration syntax
  CHECK init
using 'core-nova.o' as 'core.o'
install bootloader
creating ISO image...
xorriso 1.4.2 : RockRidge filesystem manipulator, libburnia project.

spawn qemu-system-x86_64 -no-kvm -display sdl -cpu core2duo -m 1536 -serial mon:stdio -cdrom var/run/mupdf-gw.iso -machine q35
warning: TCG doesn't support requested feature: CPUID.01H:EDX.vme [bit 1]
Bender: Hello World.

NOVA Microhypervisor v8-6ea1179 (x86_64): Apr 23 2019 21:58:39 [gcc 6.3.0] [MBI2]



[ 0] TSC:3211945 kHz BUS:1005565 kHz (measured)

[ 0] CORE:0:0:0 6:f:b:0 [0] Intel(R) Core(TM)2 Duo CPU T7700  @ 2.40GHz

Hypervisor reports 1x1 CPU 

Warning: CPU has no invariant TSC.

CPU ID (genode->kernel:package:core:thread) remapping

 remap (0->0:0:0:0) boot cpu

Hypervisor info page