Bug #86785

Calling scheduler command on CLI throws error if not in /var/www/html

Added by Chris Müller 5 months ago. Updated 3 months ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
scheduler
Target version:
-
Start date:
2018-12-21
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Calling the scheduler command on CLI throws an error, if the TYPO3 installation is not running in /var/www/html/.

Given the installation, e.g., in /var/www/example.org and calling on CLI

/var/www/example.org/public/typo3/sysext/core/bin/typo3 scheduler:run

the following error is given back:

In GeneralUtility.php line 2172:                                                     
Could not create directory "/var/www/html/var/log/"!

Yes, the script has no right to write there, but it is also the wrong directory. It should write into /var/www/example.org/var/log/.

screenshot.png View (72.8 KB) Joerg Boesche, 2018-12-19 16:02


Related issues

Related to TYPO3 Core - Bug #87261: Upgrade wizard for scheduler tasks with invalid Logger instance paths Under Review 2018-12-21
Related to TYPO3 Core - Bug #87780: Extbase Task should call parents __sleep and __wakeup Methods Under Review 2019-02-25
Related to TYPO3 Core - Bug #86941: Logger instances in scheduler tasks are deserialized with outdated paths Under Review 2018-11-16
Duplicated by TYPO3 Core - Bug #87715: Exception while deserialization of a task object Closed 2019-02-14
Duplicated by TYPO3 Core - Bug #87094: A Symfony Console based scheduler task can't be executed and breaks the scheduler module Resolved 2018-12-07

Associated revisions

Revision 6342c003 (diff)
Added by Joerg Boesche 3 months ago

[BUGFIX] Exclude logger from serialize on save for scheduler task

Exclusion of the logger instance from the record during save to database.
Prevent hard-coded logfile paths in database record.
Set the logger at runtime if the task is executed.

Resolves: #86785
Releases: master, 9.5
Change-Id: I30cf258042a2ca6ec3e79a52dcf3a3849cfbe77d
Reviewed-on: https://review.typo3.org/59237
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>
Tested-by: TYPO3com <>
Reviewed-by: Chris Müller <>
Tested-by: Chris Müller <>
Reviewed-by: Benni Mack <>
Tested-by: Benni Mack <>

Revision f37c3120 (diff)
Added by Joerg Boesche 3 months ago

[BUGFIX] Exclude logger from serialize on save for scheduler task

Exclusion of the logger instance from the record during save to database.
Prevent hard-coded logfile paths in database record.
Set the logger at runtime if the task is executed.

Resolves: #86785
Releases: master, 9.5
Change-Id: I30cf258042a2ca6ec3e79a52dcf3a3849cfbe77d
Reviewed-on: https://review.typo3.org/59253
Tested-by: TYPO3com <>
Reviewed-by: Benni Mack <>
Tested-by: Benni Mack <>

History

#1 Updated by Jonas Eberle 5 months ago

I could not reproduce that with current master. Could you elaborate a bit on your environment?

Maybe you could debug what's going on in typo3/sysext/core/Classes/Utility/GeneralUtility.php line 2172 in your case?

#2 Updated by Chris Müller 5 months ago

I can reproduce the problem with TYPO3 9.5.1 on a Ubuntu 16.04 box.

When I create the folder /var/www/html/var/log and give write access to the user, who executes the script, the log file is written in this directory. But this is wrong, it should be written in /var/www/example.org/var/log.

So check, if you have such a folder and the executing user has write access. If yes, remove the write access and try it again - this should give you the error.

#3 Updated by Joerg Boesche 3 months ago

Chris Müller wrote:

I can reproduce the problem with TYPO3 9.5.1 on a Ubuntu 16.04 box.

When I create the folder /var/www/html/var/log and give write access to the user, who executes the script, the log file is written in this directory. But this is wrong, it should be written in /var/www/example.org/var/log.

So check, if you have such a folder and the executing user has write access. If yes, remove the write access and try it again - this should give you the error.

Might be an issue with the scheduler tasks. The serialized task object in table "tx_scheduler_task" has entries with the Logger and its logFile paths. If you add an scheduler task on a different environment and import the database structure with data to another server, you will get into trouble with the path. See attached screenshot.

See: /typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php:907

We should not save file paths to database tables, because of migration/deployments to other server and paths.

#4 Updated by Wolfgang Wagner 3 months ago

Same problem here with 9.5.3, deploying to another server is a problem.

#5 Updated by Gerrit Code Review 3 months ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59237

#6 Updated by Gerrit Code Review 3 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59237

#7 Updated by Gerrit Code Review 3 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59237

#8 Updated by Gerrit Code Review 3 months ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/59253

#9 Updated by Joerg Boesche 3 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#10 Updated by Joerg Boesche 3 months ago

  • Related to Bug #87261: Upgrade wizard for scheduler tasks with invalid Logger instance paths added

#11 Updated by Georg Ringer about 1 month ago

  • Duplicated by Bug #87715: Exception while deserialization of a task object added

#12 Updated by Georg Ringer about 1 month ago

  • Duplicated by Bug #87094: A Symfony Console based scheduler task can't be executed and breaks the scheduler module added

#13 Updated by Achim Fritz 25 days ago

  • Related to Bug #87780: Extbase Task should call parents __sleep and __wakeup Methods added

#14 Updated by Benni Mack 13 days ago

  • Related to Bug #86941: Logger instances in scheduler tasks are deserialized with outdated paths added

Also available in: Atom PDF