Pheanstalk_Command_DeleteCommand->parseResponse('NOT_FOUND', NULL) - php

I got this error when I try to delete job from pheanstalk using
$this->pheanstalkObj->delete($job);
/pheanstalk/classes/Pheanstalk/Connection.php(121): Pheanstalk_Command_DeleteCommand->parseResponse('NOT_FOUND', NULL)
/pheanstalk/classes/Pheanstalk.php(508): Pheanstalk_Connection->dispatchCommand(Object(Pheanstalk_Command_DeleteCommand))
/pheanstalk/classes/Pheanstalk.php(67): Pheanstalk->_dispatch(Object(Pheanstalk_Command_DeleteCommand))
/Altibbi/BeanstalkEngine.php(844): Pheanstalk->delete(Object(Pheanstalk_Job))
/var/www/altibbi/2.6.3.5/application/controllers/CliController.php(959): Altibbi_BeanstalkEngine->workQueue('recentactivity')
/var/www/altibbi/2.6.3.5/application/controllers/CliController.php(123): CliController->beanstalkWorker('recentactivity')
/Zend/Controller/Action.php(514): CliController->indexAction()
/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action->dispatch('indexAction')
/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
what is the problem?
Thanks

The job does not exist, is buried or reserved by a client. You can get more info about the responses in the protocol description

"NOT_FOUND" if the job does not exist or is not either reserved by the client, ready, or buried. This could happen if the job timed out before the client sent the delete command.

Related

Roundcube attachment upload internal server error

So basically I have been looking for a solution for like two days straight and nothing seems to be helping.
I am using Roundcube mail client with IMAP, postfixadmin and dovecot and whenever I try to upload attachments, I get an internal server error.
Here is something I managed to catch in logs:
[11-Nov-2021 01:41:27 UTC] PHP Fatal error: Uncaught TypeError: fclose(): Argument #1 ($stream) must be of type resource, null given in /var/www/roundcube/program/lib/Roundcube/rcube_imap_generic.php:430
Stack trace:
#0 /var/www/roundcube/program/lib/Roundcube/rcube_imap_generic.php(430): fclose()
#1 /var/www/roundcube/program/lib/Roundcube/rcube_imap_generic.php(1149): rcube_imap_generic->closeSocket()
#2 /var/www/roundcube/program/lib/Roundcube/rcube_imap.php(215): rcube_imap_generic->closeConnection()
#3 /var/www/roundcube/program/lib/Roundcube/rcube.php(1038): rcube_imap->close()
#4 /var/www/roundcube/program/include/rcmail.php(921): rcube->shutdown()
#5 [internal function]: rcmail->shutdown()
#6 {main}
thrown in /var/www/roundcube/program/lib/Roundcube/rcube_imap_generic.php on line 430
There are a lot of settings all around the server so if you think that you need some of them for debugging, just ask and I'll happily put them here
EDIT: I made a quick video with all the things going on. You can see that upload "failed" with internal server error message, but after refreshing the page, attachment is there and it's being sent with email, and after receiving that email, I can't see attachment preview in email, but when I click on it I can see it and download it.
After a few long days, I finally managed to figure this out on my own, and it's really simple. So what's happening is that rounducbe is trying to close file that doesn't exist.
So, to all of you who are facing with the same problem, to fix this you have to edit file "path/to/roundcube/program/lib/Roundcube/rcube_imap_generic.php" on line 430
Change this:
protected function closeSocket()
{
#fclose($this->fp);
$this->fp = null;
}
Into this:
protected function closeSocket()
{
if($this->fp){
#fclose($this->fp);
}
$this->fp = null;
}

Podio error when getting apps

Error
ErrorException: array_merge(): Argument #1 is not an array in /my/server/vendor/podio/podio-php/lib/PodioObject.php:200
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'array_merge(): ...', '/my/server/...', 200, Array)
#1 /my/server/vendor/podio/podio-php/lib/PodioObject.php(200): array_merge(NULL, Array)
#2 /my/server/vendor/podio/podio-php/models/PodioApp.php(39): PodioObject::member(Object(PodioResponse))
#3 /my/path.php(413): PodioApp::get(xxxxxxx)
This appears to be a bug with the Podio PHP SDK or Podio API. The json_response (which is causing the array_merge error) is null, yet the http response is 200. I cannot get it to occur regularly, however it occurs roughly 10% of the time on script that is running 30~ of these calls. I can run the GetApp call directly from the documentation just fine.
I know it's an error with the responses because my script breaks at different places on each rerun depending on which data hasn't been loaded from the API correctly.
Test 1: Exception at line 344 as the result of $app1 being null
Test 2: Exception at line 814 as the result of $app3 being null
etc...
This is a script that was not modified and has been in place for over 6 months, but stopped working sometime last week.
EDIT: I've also confirmed that the same error occurs with cURL, so it isn't an SDK-specific issue.
The same intermittent error is occurring for us also. Since the TLS change was rolled out.
A temporary workaround is to wrap calls in a do while loop to retry when there are errors.
E.g.
// Get item from API
$attempts = 0;
do {
try {
$item = PodioItem::get($itemId);
} catch (\Exception $e) {
$attempts++;
Log::error("PodioItemGetFailure #" . $attempts . ". " . $e->getMessage());
sleep(3);
continue;
}
break;
} while ($attempts < 3);
This is a bit nasty, so hopefully we have a resolution on the causes on Podio's side soon.
This intermittent errors should not be happening anymore :)
Unless your network connection is unstable or choppy.
Anyway it's good to have proper handling for network-dependent calls (like any Podio API call). I can only suggest that all Podio API calls should go through queueing mechanism that will allow retry in case if network is unstable or Podio is on maintenance (as example).

Wordpress Cron phpmailerexception

I have a wordpress site which has installed EasySMTP plugin.
I have a real cron task and I have unactive wp simulated cron.
My cron is running, but inside it I want to make a mail send and is not working.
In my log, I see this:
[20-Apr-2017 14:46:02 UTC] PHP Fatal error: Uncaught exception 'phpmailerException' with message 'Invalid address: (setFrom) wordpress#[domain]' in /home/user/public_html/wp-includes/class-phpmailer.php:1023
Stack trace:
#0 /home/user/public_html/wp-includes/pluggable.php(352): PHPMailer->setFrom('wordpress#[domain...', 'WordPress', false)
#1 /home/user/public_html/wp-content/plugins/innovation-factory/includes/php/functions.php(350): wp_mail('msolla#domain...', 'Tienes 1 ideas ...', '\n\t\t<html>\n\t\t<bo...', Array)
#2 /home/user/public_html/wp-content/plugins/innovation-factory/innovation-factory.php(301): enviarNotificacion('msolla#domain...', 'Tienes 1 ideas ...', NULL, Array, '\n\t\t<html>\n\t\t<bo...')
#3 [internal function]: do_this_hourly()
#4 /home/user/public_html/wp-includes/class-wp-hook.php(298): call_user_func_array('do_this_hourly', Array)
#5 /home/user/public_html/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters('', Array)
#6 /home/des in /home/user/public_html/wp-includes/class-phpmailer.php on line 1023
Obviusly I have other smtp configuration in EasySMTP. In fact, I have an smtp hosted in other server with other domain diferent to de web page domain.
If I call do_this_hourly() function out of the cron, it sends correctly the emails. I need do something different to mail in cron tasks? Maybe that wp-cron.php not load EasySMTP yet?
My cron is programmed with this command:
php /home/user/public_html/wp-cron.php
Thanks!
This seems to come from the fact that $_SERVER['SERVER_NAME'] is not set when mail is sent using cron via crontab, cli or some other command line script.
$_SERVER['SERVER_NAME'] throws a notice, $sitename is an empty string, and $from_email is simply 'wordpress#'.
WordPress does at least give you a chance to set the $from_email before it attempts to send, in which case I've added a filter which seems to work for me.
add_filter( 'wp_mail_from', function( $from_email ) {
// Domain ends with an #. Append the domain from the site url.
if ( substr( $from_email, -1 ) === '#' ) {
// Trim protocol, double forward slash, preceeding www, port, and remaind of request uri.
$from_email .= preg_replace( '#^(?:[hftps]*:)?//(?:www\.)?|[:/?].*$#i', '', get_site_url() );
}
return $from_email;
} );
$_SER
the problem is, that php doesn't get the $_SERVER[ 'SERVER_NAME' ] when executed via crontab. And that's why the phpmailer throws that exception.
I solved it by passing the variable manually in crontab. F.e:
*/15 * * * * export SERVER_NAME="server.domain.name" && php /var/www/clients/client2/web8/web/wp-base/wp-cron.php
A detailed description of this problem can be found here https://www.ask-sheldon.com/wordpress-cron-using-wp_mail-function/.

Magento Error: Cannot send headers; headers already sent in public_html/lib/Mandrill/Mandrill/Exports.php

Whenever someone either requests a password change or completes checkout I am getting this exception page come up with an error code.
"There has been an error processing your request - Exception printing is disabled by default for security reasons."
I've been to the error file and it says:
a:5:{i:0;s:114:"
Cannot send headers; headers already sent in /home/siteusername/public_html/lib/Mandrill/Mandrill/Exports.php, line 1
";i:1;s:1796:"
/home/siteusername/public_html/lib/Zend/Controller/Response/Abstract.php(148): Zend_Controller_Response_Abstract->canSendHeaders(true)
/home/siteusername/public_html/app/code/core/Mage/Core/Controller/Response/Http.php(107): Zend_Controller_Response_Abstract->setRedirect('mysite.com', 302)
/home/siteusername/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(711): Mage_Core_Controller_Response_Http->setRedirect('mysite.com')
/home/siteusername/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(689): Mage_Core_Controller_Varien_Action->setRedirectWithCookieCheck('*/*/', Array)
/home/siteusername/public_html/app/code/core/Mage/Customer/controllers/AccountController.php(752): Mage_Core_Controller_Varien_Action->_redirect('*/*/')
/home/siteusername/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Customer_AccountController->forgotPasswordPostAction()
/home/siteusername/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('forgotpasswordp...')
/home/siteusername/public_html/app/code/community/BalkeTechnologies/StoreMaintenance/Controller/Router/Standard.php(91): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
/home/siteusername/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): BalkeTechnologies_StoreMaintenance_Controller_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
/home/siteusername/public_html/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
/home/siteusername/public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
/home/siteusername/public_html/index.php(85): Mage::run('', 'store')
{main}
";s:3:"url";s:37:"/customer/account/forgotpasswordpost/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}
Been stuck on this ages and can't find a solution.
First line lib/Mandrill/Mandrill/Exports.php script had a space before the php opening tag.

Can't request data on elasticsearch

I am develloping graphs for connection logs of a website. Logs are parsed by logstash and served via elasticsearch.
I've develloped some graphs, nothing outstanding nor hard, but working.
Friday I started elasticsearch, and every script I wrote to get the data fail when I send the query.
My first thought was that I somehow modified the query, so I printed it and send it to elasticsearch (with plugin head). The query was fine and I have result.
I tried purging logs from logstash and elasticsearch, and restarting to feed them from known good data... Didn't fix anything.
Tried to see if the config has any error, used a backup of a working one, didn't work either.
As last hope, I tried to print PHP errors, and I do get an exception thrown from deep inside of elasticsearch:
Fatal error: Uncaught exception 'Guzzle\Http\Exception\ServerErrorResponseException' with message 'Server error response [status code] 500 [reason phrase]
Internal Server Error [url] http://localhost:9200/empreinte_index/mobile/_search' in /home/empreinte/vendor/guzzle/guzzle/src/Guzzle/Http/Exception/BadResponseException.php:43
Stack trace:
#0 /home/empreinte/vendor/guzzle/guzzle/src/Guzzle/Http/Message/Request.php(145): Guzzle\Http\Exception\BadResponseException::factory(Object(Guzzle\Http\Message\EntityEnclosingRequest), Object(Guzzle\Http\Message\Response))
#1 [internal function]: Guzzle\Http\Message\Request::onRequestError(Object(Guzzle\Common\Event), 'request.error', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#2 /home/empreinte/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php(164): call_user_func(Array, Object(Guzzle\Common\Event), 'request.error', Object(Symfony\Component\EventDispatcher\EventDispatcher))
#3 /home/empreinte/vendor/symfony/event-dispatcher/Symfony in /home/empreinte/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/GuzzleConnection.php on line 238
So this seems to comfort the idea that my codes are fine, but I can't find what did I done wrong, nor where to search.
Here is a minimal example of the script I use:
<?php
echo "Days";
require '/home/empreinte/vendor/autoload.php';
$client = new Elasticsearch\Client();
$Query['index'] = 'empreinte_index';
$Query['type'] = 'web';
echo ".";
//Building the timeframe needed. For brevity, using hardcoded data.
$timeframe = "{"from" : "1404165600", "to" : "1404252000" },{"from" : "1404252000", "to" : "1404338400" }";
echo ".";
$Query['body']='
{
"aggs" :
{
"temps" :
{
"range" :
{
"field" : "time",
"ranges" : ['.$timeframe.']
},
"aggs" :
{
"new_users" :
{
"terms" :
{
"field" : "is_newuser"
}
}
}
}
}
}';
echo ".";
$result = $client->search($Query);
//Parse the data to get them in usable form for graphs
echo "OK</br>";
?>
Which output "Days...", And the exception if PHP is set to display it.
(If requested, I'll post the config file and some logs).
How can I fix this? Where can I find a similar error from which I can find a fix? What does mean the error?
If you check the response it looks like a request problem: 'request.error'
When you construct the timeframe you use double quotes to construct the string but also within the string, this can be a problem as well.
I do not really think this is the problem, but try to loose the quotes around the longs representing time stamps.
Finally try to print the query and try the query in a tool like sense from elasticsearch or the head plugin or the kopf plugin.
Hope that helps

Categories