Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if 'rtorrent.dat' cache file exists/readable before using it #1912

Closed
wants to merge 1 commit into from

Conversation

Micdu70
Copy link
Contributor

@Micdu70 Micdu70 commented Jul 17, 2019

Close #1911

@Novik
Copy link
Owner

Novik commented Jul 17, 2019

Reason of this?

@Micdu70
Copy link
Contributor Author

Micdu70 commented Jul 17, 2019

The only reason is if the "share" folder has wrong permissions ; ruTorrent can still be loaded ( and we can even add a warning message about permissions issue, maybe? ).

@Micdu70
Copy link
Contributor Author

Micdu70 commented Jul 17, 2019

But... yeah... there is no "real" reason for this, there is already an error message if "settings" folder is not readable by webserver user. So I will close this...

@Micdu70 Micdu70 closed this Jul 17, 2019
@Novik
Copy link
Owner

Novik commented Jul 17, 2019

If share folder has wrong permission, then we must generate an error.
We can't retrieve all properties from rtorrent on the each call to ruTorrent (they is used in a lot of places), this is not good for performance.

@Novik
Copy link
Owner

Novik commented Jul 17, 2019

#1911 has relation to the wrong permission of share folder, right? If yes - then why user can't see an error message? He is a blind, or we have an error in diagnostic?

@Micdu70
Copy link
Contributor Author

Micdu70 commented Jul 17, 2019

@Novik: This user removed the rtorrent.dat file and I still don't really understand why he did that... He tried to find a "bug" when it's normally impossible to reproduce...

@Novik
Copy link
Owner

Novik commented Jul 17, 2019

But if he delete this file, then ruTorrent must to create it again when user reload interface (on getplugins.php call). Why this wasn't happening?
Or he delete this file every time? >:()

@Micdu70
Copy link
Contributor Author

Micdu70 commented Jul 17, 2019

With some "weird" PHP caching, it doesn't recreate the cache file. I really don't know how it is possible.

@SSoft7
Copy link

SSoft7 commented Jul 17, 2019

But if he delete this file, then ruTorrent must to create it again when user reload interface (on getplugins.php call). Why this wasn't happening?
Or he delete this file every time? >:()

Hello,
just wanted to clarify, this is not a permission issue, its a cache issue, I think I have a proper explanation for this.
image

my web server is configured to cache the mime-type application/javascript so getplugins.php is flagged as javascript type and and it does not refresh with a normal reload. (It's pretty normal to have js files cached)

and rTorrentSettings::get() loads cache when it does not exists. a simple is_readable() check on the cache file before loading the cache file should be enough to solve this.

@Novik
Copy link
Owner

Novik commented Jul 17, 2019

I understood, thanks.
With such aggressive caching you will have undefined behavior, when

  1. you will change plugins set at runtime
  2. you will use some plugins (several from them pass current state in the js variables)
  3. you will make manual changes in the user's share directory.

@SSoft7
Copy link

SSoft7 commented Jul 17, 2019

Thanks for explaining this, I was really interested in knowing what's going wrong. I can see a lot of php files are giving js output so I will just exclude PHP extension from caching.

@Micdu70 Micdu70 deleted the patch-7 branch July 19, 2019 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Caching issue with XMLRPC
3 participants