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

Empty Log Files Are Created On Each Request #186

Closed
humanier opened this issue Apr 15, 2019 · 17 comments
Closed

Empty Log Files Are Created On Each Request #186

humanier opened this issue Apr 15, 2019 · 17 comments
Assignees
Labels
bug status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. status-triage_done Initial triage done, will be further handled by the driver team

Comments

@humanier
Copy link

humanier commented Apr 15, 2019

Once Snowflake driver is registered with PHP than every time a Laravel app serves a request or runs a unit test a empty log file file is created.

Initially that behaviour was noticed with both pdo_snowflake.logdir and pdo_snowflake.loglevel=DEBUG commented out.

Uncommenting the lines and trying to assign different values (e.g. dir locations and log levels) did not help.

Besides the need to clean up empty log files we are also concerned about performance impact (an unnecessary disk I/O is done for each request).

Is there a way to completely disable logging or is it planned? Thank you

@sfc-gh-kwagner sfc-gh-kwagner self-assigned this Apr 29, 2019
@sfc-gh-kwagner sfc-gh-kwagner added the enhancement The issue is a request for improvement or a new feature label Apr 29, 2019
@sfc-gh-kwagner
Copy link
Contributor

I'll add a way to disable logging into the driver

@humanier
Copy link
Author

@notkriswagner did you guys have a chance to look at the issue? Just wondering if it's time to update the lib in our image.

@sfc-gh-kwagner
Copy link
Contributor

Not yet, I will update here when the issue is fixed

@DevRebs
Copy link

DevRebs commented Feb 25, 2020

Hi @notkriswagner ,

My company has been using the pdo_snowflake driver since mid january this year for one project.
We are currently at the staging phase.

The problem with the bug reported here is that it is not only the project making active use of the driver which ends up being cluttered with empty log files but also all the other projects sharing the same Apache instance.

This is quite problematic as right now there are around 37 projects running on this specific staging environnement and the empty logs grow quite fast in number.

It seems that the empty logs are generated whenever the stderr stream is opened.

Have you been able to make advancements on the possibility to disable the logger ?

Regards.

@humanier
Copy link
Author

humanier commented Feb 25, 2020

Hi @DevRebs. Just FYI. We have been running SF PHP driver in prod for some time already. The problem with logs still seems to be an issue couple updates since I reported the issue. So for the time being we just use a simple cron job which removes empty files every 5 mins or so.

@daum
Copy link

daum commented Jan 27, 2021

@sfc-gh-kwagner we are also hitting this problem, we recently switched from the ODBC driver once this was out of preview, but the logs are creating tons of files on our system too so we have to also do the cron removal of the files right now. In a high traffic site the amount of files it creates is pretty high, creating an inode resource restraint too.

@sfc-gh-kwagner
Copy link
Contributor

Hi @daum this issue was just fixed in our libsnowflakeclient driver and will make it upstream into this driver in the next release

@DevRebs
Copy link

DevRebs commented May 11, 2021

Hello @sfc-gh-kwagner ,

Can you provide an estimated date for the next release ?

Thank you in advance.

@sfc-gh-dszmolka
Copy link
Contributor

hi - there's been a couple releases since this issue was raised, so closing this issue for now. If it's still a problem, do comment please and I'll reopen and we can look.

@ashnazg
Copy link

ashnazg commented May 3, 2024

Discovered similar behavior today and eventually traced it to the pdo_snowflake driver. In our case, just executing PHP (no driver code in play) was enough for a logs subdir to be created in whatever directory I ran the PHP CLI from... even just php -v was enough to trigger a logs subdir creation.

I eventually found that disabling the driver was enough to prevent the behavior.

I now have pdo_snowflake.logdir set to an explicit path that all devs have write access to, so that should semi-resolve my own issue, which was that running CLI from any dir where the user did not have write perms would trigger a big three-sentence error:

Error creating log directory. Error code: Permission denied
Error during log initialization

My question is, why does the driver insist on touching a 'logs' dir at what seems to be module initialization by the PHP executable? Wouldn't it be less intrusive to only do such a touch when the driver actually wanted to write something, and then issue the error?

@salvor-hardin
Copy link

Shouldn’t this log be disabled by default?
I’ve never seen anything else than the folders created everywhere.

@sfc-gh-dszmolka
Copy link
Contributor

thank you for your comments and feedback - reopening this to investigate

@sfc-gh-dszmolka sfc-gh-dszmolka added status-triage Issue is under initial triage and removed enhancement The issue is a request for improvement or a new feature labels May 6, 2024
@sfc-gh-dszmolka
Copy link
Contributor

confirmed this is a bug (empty logs directory created in cwd upon module initialization) thank you again for drawing our attention to it - we'll work on a fix and i'll keep this thread posted.
workaround as @ashnazg mentioned ,explicitly configure pdo_snowflake.logdir to point to some writable directory.

@sfc-gh-dszmolka sfc-gh-dszmolka added bug status-triage_done Initial triage done, will be further handled by the driver team and removed status-triage Issue is under initial triage labels May 6, 2024
@sfc-gh-dszmolka sfc-gh-dszmolka added the status-pr_pending_merge A PR is made and is under review label May 18, 2024
@sfc-gh-dszmolka
Copy link
Contributor

Addressed in:

since the fix involves the underlying libsfclient too; a libsfclient bump will be needed after the fix is in the underlying library

@sfc-gh-dszmolka sfc-gh-dszmolka added status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. and removed status-pr_pending_merge A PR is made and is under review labels May 28, 2024
@sfc-gh-dszmolka
Copy link
Contributor

Both PRs are merged. Next steps:

  1. release new libsnowflakeclient with the fix
  2. (pending 1) release new php driver based on fixed libsnowflakeclient

I'll keep this thread posted

@sfc-gh-dszmolka
Copy link
Contributor

fixed release is expected to be available towards mid June 2024

@sfc-gh-dszmolka
Copy link
Contributor

fix released with v3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug status-fixed_awaiting_release The issue has been fixed, its PR merged, and now awaiting the next release cycle of the connector. status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

No branches or pull requests

7 participants