locked
Problem with file change notification after an FTP upload RRS feed

  • Question

  • User-1364852999 posted

    Hi,

    The components of the server : IIS 6.0 (with 2 webgarden used) + PHP 5.3.3 NTS x86 VC9 + FastCGI 1.5 + WinCache 1.1.

     

    WinCache configuration :

    wincache.ocachesize = 18
    wincache.fcachesize = 6
    wincache.ttlmax = 0
    wincache.enablecli = 1
    wincache.ucenabled = 0
    wincache.ignorelist = "test.php"

     

    I have a problem with the file change notification function when I update my PHP files with the FTP plugin of the Notepad++ software. When I upload a file to the server (to replace an existing file), the file is well updated in the Windows Explorer of the server but if I access it by HTTP, I obtain yet the old version of the file. In fact, the WinCache cache has not been refreshed despite the file change notification function is enabled (by default). I precise that this problem is totally random because sometimes after I do an upload the cache is well refreshed and sometimes not.

     

    Apparently, I can't reproduce the problem with an other FTP client. With FileZilla client per exemple, after an upload, the WinCache cache seems to be always refreshed.

     

    If I update my files directly through the Windows Explorer server (with notepad per exemple) the WinCache cache is well updated.

     

    Do you think the FTP uploads/writes done by Notepad++ "are not seen" by the file cache change detection mechanism ?

     

    Or could this problem can be due to the web garden of my application pool (I know that web garden are well supported since WinCache 1.1) ?

     

    The difference of my PHP files is per exemple that in the original file, I have a query commented with //mysqli_query(blabla); and if I uncomment this request and upload the file, the query is not executed because the file cache has not been refreshed (but the on disk file yes). Don't know if this present an interest for debugging.

     

    Bye.

    Friday, October 22, 2010 9:38 AM

All replies

  • User-1364852999 posted

    Hi guys,

     I have yet the same problem three months later :(

     When I upload PHP files by FTP (Notepad++ FTP plugin) , the filecache is not always updated (random problem).

    Any idea ? Related to webgarden ?

    It's would be nice if it's could be fixed in the next release.

    Bye.

    Tuesday, February 1, 2011 11:18 AM
  • User-1364852999 posted

    It seems that this bug with file change notification will never be investigated and fixed.

    Sad :(

    Sunday, April 3, 2011 5:33 AM
  • User-1672167363 posted

    Hello,

    I suggest that to get issues,bugs investigated and fixed this Forum is not where to get this done.

    Yes, You have a problem that could be Bug,Configuration,Version of PHP installation / IIS Server OS related.

    A direct approach to get Bugs and Issues resolved is to contact the Team Members at the Windows Cache Project

    Site. The current location of the Windows Cache Project is at Source Forge.

     The Windows Cache project site has a Bug Reporting section and Discussion Board.

    You can report the issue ro check what other users have done.

    If you provide the information that you posted in the IIS Net Forum along with your configuration information

               the members of the Windows Cache Project will try and help to resolve the issues.

    I know that for the Project Manager / Project Team members time is very limited both:

             for  Monitoring posts here at IIS Net Forum and working on code for next release.

    Alternative contact is Ruslany he has Blog in IIS Net Center and tries to help users with Windows Cache issues.

    I hope this helps,

    Martin

     

    Sunday, April 3, 2011 12:17 PM
  • User-1637866776 posted
    Can you try the latest dev build from here: http://forums.iis.net/t/1176918.aspx
    Monday, April 4, 2011 1:51 PM
  • User-1364852999 posted

    Hi,

    Thanks but the server is under production and I am a little reluctant to install beta software unless you think that this 1.2.x dev version is already quite stable ?

    Tuesday, April 5, 2011 4:56 AM
  • User-1637866776 posted

    The changes in this build only affect the file change notification code path related to deletion of directories. No other changes to the existing code were made, so in theory the remaining functionality is as stable as it was in 1.1. I am using this build with my site for a week now.

    Would it be possible for you to test it for a particular site on the production server, thus not affecting the rest? You can for example install another instance of PHP on that server and configure it to use the dev build of wincache. After that you can setup a test site and configure it to use that PHP installation instance. You can use PHP Manager to setup another PHP instance on IIS and configure a site to use it.

    Tuesday, April 5, 2011 1:01 PM
  • User-1364852999 posted

    Hi,

     

    I just installed WinCache 1.2 dev (1.2.331.0) on the server. I will do some FTP uploads these days to see if file cache is well updated or not. But the problem is random so my tests could take some days.

     

    Thanks.

    Wednesday, April 6, 2011 1:51 AM
  • User-2048372337 posted

    I'm having the same problem from time to time. We just uploaded a change and even called wincache_refresh_if_changed(), and the new file would not load. I had to delete the file, refresh, upload the file, refresh and then it finally showed up.

    Monday, August 1, 2011 3:38 PM
  • User-1364852999 posted

    Hi,

     Happy to see that I am not the only user with this file refresh problem.

     What FTP software do you use laurin1 ?

     I have tested WinCache 1.2 but I have yet observed the upload bug.

     IIS team, What do you plan to do for fix this bug ?

     Thanks.

     Julien

    Tuesday, August 2, 2011 3:26 AM
  • User-2048372337 posted

    Actually, ours occurred with PHPStorm's Deployment function (built in FTP client, second attempt) AND we did it with robocopy (the first time.) We use it all the time, but this has happened 2 or three times.

    Tuesday, August 2, 2011 10:07 AM
  • User-1364852999 posted

    Hello Eric,

    I allow myself to up this post as the problem about file change notification after an FTP upload is still alive 5 years after.

    Sometimes (randomly and not reproductible), when I upload a PHP file with an FTP client software like FileZilla or the FTP plugin embedded in Notepad++, the new file is not taken into account and the server processes yet the old file stored in the WinCache file cache.

    However, the new uploaded file is the right on the server hard disk.

    Most of the time (90% of the uploads), the file change notification (fcndetect = 1) mechanism works very well.

    I have had yet this bug this week. After verification in the wincache.php (File System Cache tab), the Add time column displays the TTL of the old file (a very long time) confirming the new file has not been refreshed.

     FYI, the use of the wincache_refresh_if_changed() function doesn't permit to load the new file. Old file is still used by IIS. The solution is to reupload the file (sometimes multiple times) or to stop/start IIS or to make a change in the file from the server explorer.

     I use IIS 8.0, PHP 7.0.0 NTS x64, WinCache 2.0.0.2.

     Cache Settings

    wincache.apppoolid 
    wincache.chkinterval 0
    wincache.enablecli 1
    wincache.fcachesize 16
    wincache.fcenabled 1
    wincache.fcenabledfilter
    wincache.fcndetect 1
    wincache.filecount 4096
    wincache.filemapdir D:\Temp\php\wincache\
    wincache.ignorelist test.php
    wincache.maxfilesize 256
    wincache.namesalt
    wincache.reroute_enabled 0
    wincache.scachesize 16
    wincache.ttlmax 0
    wincache.ucachesize 64
    wincache.ucenabled 0

     My file cache is used at 5 % and hits are 99,8 %. Here the details :

     File Cache Overview

    Cache uptime 77 hours 4 minutes 32 seconds
    Cached files 124
    Total files size 823.82 kB
    Hits 175947
    Misses 387
    Total memory 16 MB
    Available memory 15.14 MB
    Memory overhead 12.34 kB

    The problem was still here with WinCache 1.1, IIS 6.0 and PHP 5.3 as you can see.

    Andy idea how to resolve this change notification problem ? It is not a major bug but it is pretty boring because, sometimes, I believe new code has been taken into account and in fact no...

    Sunday, December 13, 2015 8:25 AM
  • User409000176 posted

    Sometimes (randomly and not reproductible), when I upload a PHP file [...] the new file is not taken into account and the server processes yet the old file stored in the WinCache file cache.

    Ah, that's not good.

    Most of the time (90% of the uploads), the file change notification (fcndetect = 1) mechanism works very well.

    I've looked at the change notification code, when I tried to fix a few bugs in there previously.  I have notice one rather large comment indicating a blind spot in the code:

            // TODO: Handle ERROR_NOTIFY_ENUM_DIR - change buffer overflowed & we
            // TODO: missed some changes.
            // TODO: Not sure what to do here, since we don't have a mechanism for
            // TODO: invalidating a directory and all files under the directory.
            // TODO: The aplist cache is only designed to lookup full paths. Any
            // TODO: other enumeration would be an O(1) traversal of the cache.

    Translating into English:

    "Sometimes the change notification can fail, and WinCache will "miss" a change notification for one or more files.  Fixing this will be computationally expensive."

    This situation can happen when a lot of files are updated at the same time in the same directory.  It's also a factor of how busy the operating system and the file I/O system is at the time. I don't have an exact number for whatever "a lot of files" is." Do you see this problem when you upload large numbers of files?

    This comment also explains why touching the file after it's been missed would cause the change notify to eventually pick up the change.

    I don't have  a feel for how often we see this issue.  I'll have to add some diagnostic tracing to see how frequently this is hit.

    As you've mentioned, the work around is to either (a) re-upload the file or (b) restart the site, both of which are not wonderful options.  I will address this issue as time permits.  If you would like, please feel free to file a bug on http://bugs.php.net for the WinCache component. 

    Thx!

        --E.

    Monday, December 14, 2015 1:13 PM
  • User-1364852999 posted

    Thanks for the explanations Eric.

    As recommended, I have created a bug report on php.net :

    https://bugs.php.net/bug.php?id=71120

    I upload only one PHP file at the same time to the server. Never multiple.

    And my server hard disks I/O activity is very reasonable (just writes for IIS logs and reads for IIS/PHP/MySQL). Furthermore, it 's a 15K SAS RAID 1 configuration.

    It's the last bug I have with the PHP + WinCache duo. I really hope you will be able to fix it even if it is "computationally expensive".

    I am available if you want me to test your diagnostic tracing. You have my mail ;)

    Thanks.

    Monday, December 14, 2015 3:20 PM
  • User962350831 posted

    Just an opinion on this...

    If wincache.ignorelist was properly implemented then one could only use the filecache - very useful by the way - for application files or directories you know will not be changing and not for "content" files.

    Maybe that would be much easier than fixing a failing change notification.

    Friday, December 18, 2015 10:48 AM
  • User-2064283741 posted
    Also don't use Web gardens. That only adds a multitude of complexity here. You have no need to use more than one. You need to elevate that area from your solution.
    Friday, December 18, 2015 11:02 AM
  • User-1364852999 posted

    Hello,

    I do not use more webgardens. It was 5 years ago with IIS 6.0 ;)

    "for application files or directories you know will not be changing"

    Personally, I do not know at the advance which PHP files will be or not modified and when.

    Friday, December 18, 2015 11:37 AM
  • User-1364852999 posted

    Hi DropPhone,

    It seems that the file change notification problem has greatly extended with PHP 7 and WinCache 2.

    In the past, I had this problem once occasionally. Since, I have migrated from PHP 5.6 and WinCache 1.3.7, I have to upload PHP scripts many times almost every time for them to be refreshed. It became infernal ! I think my code is up to date and in fact not. If at least the wincache_refresh_if_changed() function worked.

    Did you have time to look in the problem ? Please, help.

    I have seen the thread "Reroute_enabled internal cache is not refreshed". Don't know if it is related to my problem.

    Just a last thing. Do you have the changelog for the 2.0.0.4 version available on SourceForge ?

    Thanks.

    Tuesday, January 19, 2016 3:22 AM
  • User409000176 posted

    Sorry for the delay; I just got back last week, and I've been focused on stabilizing WinCache's user cache for PHP7.  Now that WinCache 2.0.0.5 is out, I can get back to improving the file change notification part of WinCache.

    It seems that the file change notification problem has greatly extended with PHP 7 and WinCache 2.

    Yikes!  That's discouraging news.  Hopefully it will make it easier for me to repro the problems as I investigate.

    Just a last thing. Do you have the changelog for the 2.0.0.4 version available on SourceForge ?

    I've updated the PECL package, so you should be able to find the changes in the changelog.

    Thx!

        --E.

    Wednesday, January 27, 2016 7:26 PM
  • User-1364852999 posted

    Thank you for your follow up about WinCache. See you soon.

    Just FYI, the Opcache crash (event related to php-cgi.exe and php_opcache.dll) has finally not yet been fixed by PHP 7. I have a new dump file but nobody from Zend answers to the bug ticket...

    Thursday, January 28, 2016 4:14 AM
  • User-1364852999 posted

    Hello DropPhone.

    Sorry but I still have the file cache refresh problem despite updating to 2.0.0.6 version of WinCache :(

    Tuesday, April 19, 2016 4:12 PM
  • User409000176 posted

    Good morning, Julien!

    Darn, I thought (hoped?) I had fixed it with 2.0.0.6.

    I've been unable to repro the problem where change notifications get lost, either with a single changed file, or with batches of files. I've been unable to repro with files updated via either SMB copy or via FTP copy.

    I will give another hard look at this area of the code as time permits.

    Thank you for bringing this to my attention!

        --E.

    Tuesday, April 19, 2016 6:15 PM
  • User1794435294 posted

    Hello,

    I can reproduce this issue by updating files via network folder with 2.0.0.8 and PHP 7.1 on Windows Server 2012 R2 / IIS 8.5

    This only happens something like once in 10.

    Seb

    Monday, July 17, 2017 2:02 PM
  • User409000176 posted

    This only happens something like once in 10.

    Interesting.  Please tell me more about your repro case.

    • Are you using the Notepad++ FTP client?  Can you repro this with a different FTP client?
    • How many files are you uploading?  Is it just one, or is it a batch of files?
    • Does the file eventually get correctly fetched (like after 2 to 30 seconds)?  Or, once it is bad, it stays bad forever.

    Thx!

        --E.

    Monday, July 24, 2017 6:59 PM
  • User1794435294 posted

    I am working on my project using PHPStorm by opening my project directory via a shared folder on the network (located on my iis server)

    When I edit a file and save it, sometimes, modification are not taken in account.

    I have to edit my file again (by adding extra chars), resave it, and then remove extra chars and resave it.
    (But I can also restart the iis server)

    Monday, July 24, 2017 7:10 PM
  • User409000176 posted

    I am working on my project using PHPStorm by opening my project directory via a shared folder on the network (located on my iis server)

    So, FTP is not involved in your repro?

    When I edit a file and save it, sometimes, modification are not taken in account.

    So, you're touching a single file?  And the file is in a directory that is on a hard drive that is directly connected to the IIS server?

    Is the file content, or is it a .php file?  Are you using Zend Opcache?  If so, you should look at the opcache.revalidate_freq setting.

    Thx!

        --E.

    Tuesday, July 25, 2017 7:12 PM
  • User1794435294 posted

    So, FTP is not involved in your repro?

    Indeed, I am NOT using FTP.

    So, you're touching a single file?  And the file is in a directory that is on a hard drive that is directly connected to the IIS server?

    Is the file content, or is it a .php file?

    Yes, this happens when I modified a single file.
    Not sure to understand what you mean by "Is the file content, or is it a .php file?" but I am working on .php files

    But sometimes, this could happens on multiple files when I pull changes from my git repository.

    Are you using Zend Opcache?  If so, you should look at the opcache.revalidate_freq setting.

    Yes. All values are default, so opcache.revalidate_freq is set to "2".
    Should I set it to "0"?

    Wednesday, July 26, 2017 8:10 AM
  • User409000176 posted

    Not sure to understand what you mean by "Is the file content, or is it a .php file?"

    Ah, sorry.  'Content' in this case Is this a .png, .jpg, .gif, .txt, or other non-PHP code file.

    All values are default, so opcache.revalidate_freq is set to "2".
    Should I set it to "0"?

    Setting to "0" would make your situation worse....Zend Opcache would *never* re-read files from the disk in that case.  "2" means that you could have a period of up to 2 seconds before Zend Opcache checks to see if a file has changed.  So, you could have a couple of seconds before the changes actually show up.

    Just to confirm, in your case, you are *never* seeing the changes show up (after > 2 seconds).  You are forced to re-edit the file, save, and then the changes will appear.  Is this correct?

    Wednesday, July 26, 2017 7:35 PM
  • User1794435294 posted

    That's correct.

    Sometime it can pass more than 1 minute before I understand that the issue is because the file changes wasn't read.

    Thursday, July 27, 2017 8:10 AM
  • User409000176 posted

    Does the problem go away if you set wincache.fcenabled = 0?

    Thursday, July 27, 2017 7:03 PM
  • User1794435294 posted

    I didn't reproduce the error since 1 week after I set

    wincache.fcenabled = 0

    Tuesday, August 8, 2017 4:27 PM
  • User409000176 posted

    Since you're using Zend Opcache, and these are .php files, you shouldn't see a drop in performance.  So, I would suggest you continue operating with wincache.fcenabled = 0.

    I will continue trying to repro the problem on non-PHP files.

    Tuesday, August 8, 2017 10:42 PM