Archived posts, use them to search

Issue with files updating properly

by Stewart Carswell -
Number of replies: 4

Hello,

I have a VPL activity set up in Moodle, and I'm adding the scripts to assess and grade the assignments on a separate server. However, when I copy updated scripts to the server (using rsync or scp), I'm not seeing the files within Moodle. 

If I add "ls -l /my/example/assessment" to vpl_evaluate.sh and evaluate it, I get a different output compared with when I ssh to the server and run ls -l /my/example/assessment.

Also, when I installed a new package on the server, it was not seen from the VPL activity in Moodle. I restarted the server and I could then see the updated files and packages from Moodle, but I don't want to be restarting the server each time I make a change.

Can you help me diagnose the problem? Is there some caching issue going on somewhere?

In reply to Stewart Carswell

Re: Issue with files updating properly

by Stewart Carswell -
I'm using vpl jail system 2.3.1. I've done some digging into this, and the issue may be with overlayfs not updating the files in /jail. Is there a way to force it to update them?
In reply to Stewart Carswell

Re: Issue with files updating properly

by Juan Carlos Rodríguez-del-Pino -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Hi Stewart,

I will try to answer your questions.

About your first question: I don't know from where to where are you transferring the scripts and the cause of the problem you describe. Notice that Moodle and VPL information is based on a DB. In any case, If you want to transfer files (scripts or other types) from an external source to VPL the easy way is going to the execution files and drop it there.

If you are working with scripts notice that you may need the use of "files to keep when running" option.

If you are working with multiple VPL activities that use common scripts or other files the use of the "based on" at "Execution options" can easily your work.


About your second question: I think that you are referring to the installation of packages on your execution server (jail-server). From version 2.3 of the Vpl-jail-system, it is not strictly necessary to restart the service after installing or updating any packages, but in some case, it may be needed to restart the vpl-jail-system to update the change into the jail. In any case, you don't need to restart the machine.

systemctl restart vpl-jail-system

Best regards,
Juan Carlos.
In reply to Juan Carlos Rodríguez-del-Pino

Re: Issue with files updating properly

by Stewart Carswell -

Hi Juan Carlos, thanks for getting back to me.

The first question is about the vpl-jail server as well. The issue is with copying files onto the vpl jail server from a local machine. For example, assessment scripts, to be called by vpl_evaluate.sh from Moodle. We save these on the execution server in the directory /usr/share/vplscripts. However, if a file is edited locally and then copied onto the server again, the change does not propagate into /jail/usr/share/vplscripts unless the system is restarted. Is there a way to get overlayfs to update the files in /jail automatically, or whenever it detects a change, or periodically?

The second question is similar, we are not seeing new packages added under /jail after they are installed. You said in your reply "but in some case, it may be needed to restart the vpl-jail-system to update the change into the jail." Can you elaborate on which cases it may be necessary please?

Many thanks, Stewart

In reply to Stewart Carswell

Re: Issue with files updating properly

by Juan Carlos Rodríguez-del-Pino -
Picture of Particularly helpful Moodlers Picture of Plugin developers

It seems that overlayFS (or the kernel, not clear for me), caches access to the underlying filesystem (lowerdir). This behaviour affects especially to the content of the files and internally to the permissions of files.
The tests show that if the content or the access mode of a file in the underlying file system change after been accessed by the overlayFS, overlayFS still show the previous content. This behaviour seems to no effect on new files.

The problem can be resolved without restarting the server or the service, but paying a temporal performance cost. The solution is using the file /proc/sys/vm/drop_caches.

After changing files in the underlying file system (installing/updating packages or modifying files), as root, you may use the following command to do the overlyFS be aware of the changes

sync; echo 7 > /proc/sys/vm/drop_caches

This will do the kernel to drop the caches. For a while, the file system will be slower until the system recaches common used data.
For more details see https://www.kernel.org/doc/Documentation/sysctl/vm.txt.

About the effect on the jail of installing packages in the host and with this tested behaviour, I must change my previous affirmation saying that always is better to restart the service or drop caches.

Best regards,
Juan Carlos.