taoteh1221 / Open_Crypto_Tracker

Bitcoin / Alts private portfolio tracker, with email / text / alexa / telegram price alerts, charts, leverage support and much more.
https://taoteh1221.github.io
GNU General Public License v3.0
92 stars 22 forks source link

Recent built of 5.05.0 is throwing Error Code: 500 #39

Closed s1-ranjan closed 2 years ago

s1-ranjan commented 2 years ago

The new version of this app is throwing 5.05.0 is throwing error code 500, while trying to auto-refresh the portfolio or when trying to save the cookies under settings.

taoteh1221 commented 2 years ago

Is this with the latest default config.php (not edited by you)? Please try with the latest default config.php file if you have not tried that yet. Let me know if that still gives you trouble. I have no problem myself this way, I cannot replicate your issue.

taoteh1221 commented 2 years ago

If using the latest default config.php does not help, you could post any apache error logs you may have, which would help me debug it.

s1-ranjan commented 2 years ago

Sorry for the delay in my reply, I am not able to test with your default configuration file, whereas I am enclosing my apache error log with this message with the hope this can help you in figuring out the issue, I'll sooner perform my test with the default settings and let you informed my finding. coin.0or1.xyz.error.log

s1-ranjan commented 2 years ago

I am wondering with one question can by enabling the DEBUG MODE in the configuration file can provide some information with the error code 500.

s1-ranjan commented 2 years ago

The default configuration has given me the same result on my side, i.e., error code 500, I am using this application with PHP / Nginx packages on my server, maybe this Nginx might be causing some issue with this application.

taoteh1221 commented 2 years ago

Hello @s1-ranjan, thank you for trying with the default config.php, and sending your error logs. Unfortunately, it looks like you do not have PHP errors logging to you nginx error log file. Please consult with your server's system administrator about having PHP error logging enabled, and send me a new set of error logs after you do.

Also of importance, which version of open crypto tracker were you running before, and does it still run ok now on this server if you downgrade to that version instead? You can download and try older versions from here:

https://github.com/taoteh1221/Open_Crypto_Tracker/releases

taoteh1221 commented 2 years ago

I am wondering with one question can by enabling the DEBUG MODE in the configuration file can provide some information with the error code 500.

Yes DEBUG MODE may help, in fact I forgot we do need to enable showing PHP errors in the app, so your server may already show PHP errors ok (sorry please disregard my previous message)

If you change $ct_conf['init']['error_reporting'] to 1 at the top of config.php, your error logs should show the PHP error causing the problem:

https://github.com/taoteh1221/Open_Crypto_Tracker/blob/main/config.php#L18

taoteh1221 commented 2 years ago

I'm sorry, instead please change $ct_conf['init']['error_reporting'] to -1 at the top of config.php, and then your error logs should show the PHP error causing the problem:

https://github.com/taoteh1221/Open_Crypto_Tracker/blob/main/config.php#L18

s1-ranjan commented 2 years ago

I tried those changes in my config file but I don't see any output at the front end and moreover I don't find any log file in my case folder of the application.

taoteh1221 commented 2 years ago

It won't output to the front-end, it should only add the PHP errors to the NGINX error logs. Check there, the same logs you sent me earlier. Thank you for the help debugging this, we'll get it fixed.

s1-ranjan commented 2 years ago

@taoteh1221, I have upload the error log, please have a look. coin.0or1.xyz.error.log

taoteh1221 commented 2 years ago

Thanks @s1-ranjan I'll have a look at it later this week, and see what we can do.

taoteh1221 commented 2 years ago

@s1-ranjan I'm not seeing any fatal PHP errors in the logs. I am seeing "upstream sent too big header" NGINX error as the last log entry, indicating the issue is your NGINX configuration.

See these pages for possible solutions:

https://stackoverflow.com/questions/23844761/upstream-sent-too-big-header-while-reading-response-header-from-upstream

https://ma.ttias.be/nginx-proxy-upstream-sent-big-header-reading-response-header-upstream

I have zero experience with NGINX, so just a guess. This app was developed on Apache, not NGINX.

s1-ranjan commented 2 years ago

@taoteh1221 I am using Hestia Control Panel in my VPS and I tried to configure the subdomain to serve this application from Apache mode, but the problem persisted, I am not sure what's the error is when I tried with the default configuration file there is no such error with the application and today I was looking for some alternative for my panel, and I came across along cloudpanel.io on GitHub with this comment https://github.com/cloudpanel-io/cloudpanel-ce/issues/34#issuecomment-817152348 , which suggest a good way to migrate the application from Apache to NGINX, I hope codeigniter can help in any aspect to fix this issue.

taoteh1221 commented 2 years ago

Good luck @s1-ranjan, this doesn't look like a bug in the app, seems to be a weird NGinx error with "header too big" (whatever that means). I'd switch to Apache if I were you. HostGator is pretty good, I believe they use Apache.

taoteh1221 commented 2 years ago

@s1-ranjan I just got what may be a similar issue using Apache (Size of a request header field exceeds server limit), when selecting too many charts / news feeds / coins at the same time. If you are still encountering this issue, try deleting all cookies related to the app, and slowly select only a few coins / news feeds / charts. This may help. I'll be looking into this further at some point, and will post back here again after I do.

Thanks for the report.

taoteh1221 commented 2 years ago

NOTES TO SELF ON THIS (anyone following this thread can disregard)...

When selecting too many charts / news feeds / coins, the header data can be too big:

Bad Request
Your browser sent a request that this server could not understand.
Size of a request header field exceeds server limit.

ABOVE IS FROM APACHE. MAY BE RELATED TO https://github.com/taoteh1221/Open_Crypto_Tracker/issues/39 ON NGINX! We may need to find a way to detect TOTAL COOKIE SIZE (OF ALL COOKIES USED BY THE APP) #BEFORE SUBMITTING DATA#. Look into it. Maybe use javascript to detect cookie size totals, and offer in the UI different storage methods? Also look into offloading chosen assets / news feeds / price charts cookie data into javascript's 'local storage' INSTEAD (like we do for saving start page on sencondary page's scroll position). Also maybe trim a couple characters off chosen news feed hashes that are saved?

taoteh1221 commented 2 years ago

@s1-ranjan The "header too big" error you encountered has been fixed as best as possible. I have decreased cookie data size where possible, and added error logging / system alerts if a user's install gets near server limits for header size (adjustable in the power user config section): https://github.com/taoteh1221/Open_Crypto_Tracker/commit/ba88c86f09febaba99b363345423fd75e8b54f2a

I should be done final code review within 24 hours from now, and release this as v5.12.2 very soon.

You'll need to delete all browser cookies for the app's domain name, if you still get the big header error on NGNIX. Then slowly add coins / price charts / news feeds until you get a warning on the screen that you are nearing the header size limit (which is what causes your NGNIX error 500, according to your logs).

Another option for you, is to increase NGNIX's configuration files limit for header size, if you are on a dedicated system or VPS (this will NOT work on a SHARED server).

Good luck, sorry it took so long to figure this out as best as possible.