drush – Deadlock on Semaphore table results intermittent service denial of the site

Experience deadlock on Semaphore table frequently, which result in service denial of the site.

Site configuration

  • Drupal version : 8.8.6
  • Apache version: Apache/2.4.46 PHP 7.2.33
  • Drush version : 10.3.1
  • MySQL Database (AWS RDS 8.0.20, with Multi-AZ and backup enabled)
  • 2 CMS nodes configured to use same drupal file system with EFS

The site is under normal traffic & it is observed that without traffic also this issues exists. It is observed that during cache reload using Drush (drush cr) the issue is consistent. Even after restarting the cms nodes, without any traffic the issue occurs. During the issue time the php-fpm active threads are in blocked state, so it cannot serve any request from Apache server.

PHP-FPM Thread count

(root@ip-xx-xx-xx-xx bin)# systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2021-04-20 16:59:08 JST; 29min ago
 Main PID: 3135 (php-fpm)
   Status: "Processes active: 50, idle: 0, Requests: 96, slow: 0, Traffic: 0req/sec"
   CGroup: /system.slice/php-fpm.service
           ├─3135 php-fpm: master process (/etc/php-fpm.conf)
           ├─3139 php-fpm: pool www
           ├─3140 php-fpm: pool www
           ├─3141 php-fpm: pool www
           ├─3142 php-fpm: pool www
           ├─3143 php-fpm: pool www

Error from php-fpm

"at /xxx/xxx/xxx/applns/drupal/st/core/lib/Drupal/Core/Database/Connection.php line 695
(20-Apr-2021 16:17:52 Asia/Tokyo) DrupalCoreDatabaseDatabaseExceptionWrapper: SQLSTATE(40001): Serialization failure: 1213 Deadlock found when trying to get 
lock; try restarting transaction: INSERT INTO {semaphore} (name, value, expire) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array
(
    (:db_insert_placeholder_0) => locale:ja::anonymous:DrupalCoreCacheCacheCollector
    (:db_insert_placeholder_1) => 992790133607e8016bd90d6.01860943
    (:db_insert_placeholder_2) => 1618903102.1116
)
 in /xxxx/xxxx/xxxx/applns/drupal/st/core/lib/Drupal/Core/Cache/CacheCollector.php on line 233 #0 /xxx/xxx/xxx/applns/drupal/st/core/lib/Drupal/Core/Database/Connection.php(659): DrupalCoreDatabaseConnection->handleQueryException(Object(PDOException), 'INSERT INTO {se...', Array, Array)
#1 /xxxx/xxxx/xxxx/applns/drupal/st/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php(357): DrupalCoreDatabaseConnection->query('INSERT INTO {se...', Array, Array)
#2 /xxxx/xxxx/xxxx/applns/drupal/st/core/lib/Drupal/Core/Database/Driver/mysql/Insert.php(32): DrupalCoreDatabaseDrivermysqlConnection->query('INSERT INTO {se...', Array, Array)
#3 /xxxx/xxxx/xxxx/applns/drupal/st/core/lib/Drupal/Core/Lock/DatabaseLockBackend.php(77): DrupalCoreDatabaseDrivermysqlInsert->execute()
#4 /xxxx/xxxx/xxxx/applns/drupal/st/core/lib/Drupal/Core/ProxyClass/Lock/DatabaseLockBackend.php(75): DrupalCoreLockDatabaseLockBackend->acquire('locale:ja::anon...', 30)
#5 /xxxx/xxxx/xxxx/applns/drupal/st/core/lib/Drupal/Core/Cache/CacheCollector.php(233): DrupalCoreProxyClassLockDatabaseLockBackend->acquire('locale:ja::anon...')
#6 /xxxx/xxxx/xxxx/applns/drupal/st/core/lib/Drupal/Core/Cache/CacheCollector.php(327): DrupalCoreCacheCacheCollector->updateCache()
#7 /xxxx/xxxx/xxxx/applns/drupal/st/core/modules/locale/src/LocaleTranslation.php(150): DrupalCoreCacheCacheCollector->destruct()
#8 /xxxx/xxxx/xxxx/applns/drupal/st/core/lib/Drupal/Core/EventSubscriber/KernelDestructionSubscriber.php(51): DrupallocaleLocaleTranslation->destruct()
#9 (internal function): DrupalCoreEventSubscriberKernelDestructionSubscriber->onKernelTerminate(Object(SymfonyComponentHttpKernelEventPostResponseEvent), 'kernel.terminat...', Object(DrupalComponentEventDispatcherContainerAwareEventDispatcher))
#10 /xxxx/xxxx/xxxx/applns/drupal/st/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(SymfonyComponentHttpKernelEventPostResponseEvent), 'kernel.terminat...', Object(DrupalComponentEventDispatcherContainerAwareEventDispatcher))

We applied transaction_isolation to READ_COMMITTED for MySQL connection, but the issue occurs again.

Currently we changed the semaphore table to MEMORY Engine and found that the issues frequency reduced. But during the load testing the issue reproduced.
We are facing the issue in our Production site, so any help will be highly appreciated.

forms – PHP Code Not Generating Results

I wanted to create a calculator on my WordPress website.

But, my code is not generating results on the page after the form Submission.

Please help,
Thank you

MY CODE:

<form method="post" >
<label for="fname">Value</label>
<input id="value" name="inp1" type="number" value="" />
<label for="lname">Result</label>
<input type="submit" name="button1" value="Calculate" />

<?php

if(isset($_POST('inp1')))
        
    {
            $x=$_POST('inp1');
            
            function fact($x)
                {   
                                $fact=1;
                                for ($i=$x; $i>0; $i--)
                                    {
                                    $fact=$fact*($x);
                                    $x=$x-1;
                                    }
                                echo "Factorial of the number is $fact";

                }
        fact($x);
        
        
    }
        
        
    else 
            {echo "Enter the number";}
    
    
?>

Deadly Seo – Boost your ranking in 30 days – Premium backlinks for Immense results- DA upto90 for $10

Deadly Seo – Boost your ranking in 30 days – Premium backlinks for Immense results- DA upto90

Deadly Seo- Boosts your ranking in 30 days through the use of premium backlinks

Seo is a battlefield and only the strong can survive.

Do not let Google and other search engines kill your site.


Deadly Seo- Better ranking in 30 days – Premium proven SEO tactics and backlinks

Deadly Seo has achieved great results for many webmasters. Check out examples of the results we have brought to our clients.

Till now you would have seen the power of Deadly seo , which could be done on your website too

Deadly SEO Procedure:

Deadly SEO uses proven SEO techniques and hence, does not make backlinks on low quality websites.

1. 20 Premium web2.0 we will make high DA, 20 premium web2.0 for you.

2. 20 Premium bookmarks: We will make 20 Premium bookmarks for you.

3. 20 high DA profile backlinks.

4. 10000 tier2 backlinks:

We understand that your backlinks cannot work until they get indexed. As a result, we power up all your backlinks we run 10000 tier2 backlinks.

Deadly SEO achieves super heavy rankings within 30 days.

High quality seo translates to better results. On the other hand, Better results mean better rankings.

Deadly SEO does precisely that.



**************100% safe and white hat********************

If you are well knowledgeable in web matters, you probably know that it is dangerous to generate thousands of backlinks within a day. That is why our SEO professionals make a few backlinks in tier 1 and a lot more in tier 2. The good thing is that our SEO services are not detectable by either panda or penguin.

=============================================================================================
OUR PACKAGES:

Deadly Seo Booster: 20 web2.0, 20 bookmarks, 20 profiles,10k tier2 backlinks- $10

Deadly SEO Ranker: 1 Premium guest post, 50 web2,0, 50bookmarks, 50 profiles, social media, 50k tier2 backlinks: $25

Deadly Seo Dominator: 5 Premium guest post, 5 PDF links, 5Infographic links, 3 google stack, 50 web2,0, 50 bookmarks, 50 profiles, Social media, 50k tier2 backlinks: $50

ORDER NOW!

.

PHP issue passing results of variables from one function to another in same file but works on other pages

I am having an issue accessing my global variables inside the same file where the variables exist. However, they work just fine when I call the same variable in other files. To call the variable in another file I have used the required_once to call my file where the globals are located and then called each variable I need individually like global $example_vairable.

The issue is that when I use global $example_vairable later on in the same file where I defined global $example_vairable it does not work. Inside of another function on the same page I have called my variable global $example_vairable and then just tested with either an echo or a var_dump. echo shows no display and var_dump provides a bool(false) telling me I have an error but I have no idea where or why.

This is in wordpress so I am using my functions file where my variables are located. Here is my code:

THE FUNCTIONS FILE GLOBAL VAIRABLE

function Total_Result(){
    global $total_result, $resultx;

     $resultxs = array($resultx);
     $total_result =  count($resultxs(0));
    //return($total_result);
}
add_action( 'after_setup_theme', 'Total_Result' );

Then the function on the same file (functions.php) that I am trying to call the global from:

add_action("wp_ajax_getvendorresponsestatus", "getvendorresponsestatus");
add_action("wp_ajax_nopriv_getvendorresponsestatus", "getvendorresponsestatus");

function getvendorresponsestatus() {
    global $wpdb, $endResult,$total_result ;
    if(isset($_POST('action')) == 'getvendorresponsestatus'){

                    echo $total_result;
        var_dump($total_result);
            var_dump($endResult);
            echo $endResult->posted_by;
        

};
}

I have also tried to pass the variable in the function itself but it too doesnt work.

add_action("wp_ajax_getvendorresponsestatus", "getvendorresponsestatus");
add_action("wp_ajax_nopriv_getvendorresponsestatus", "getvendorresponsestatus");

function getvendorresponsestatus($endResult, $total_result) {
    global $wpdb;
    if(isset($_POST('action')) == 'getvendorresponsestatus'){

                    echo $total_result;
        var_dump($total_result);
            var_dump($endResult);
            echo $endResult->posted_by;
        

};
}

seo – Google results for my site are showing the title of a hidden modal element instead of my meta description

I have a site that features a listing of companies. Every company has its own page. Every page has its own meta description. There is no nofollow or noindex tag or anything like that.

Yet, instead of the meta description, Google chooses to show the title of an insignificant modal element on the page. This is true for most results from the site. Maybe 10% of results show the meta description correctly.

This behavior is so seemingly random that I have no idea how to help the situation. There is a big H1 title on the page, so if Google is ignoring the meta description, I would expect it to pick that.

The modal is hidden and it’s not even the first modal when you look at the HTML source of the page.

Any suggestions?

How to output results of an AppleScript image resizing script and display in automator

I am currently using an automator flow that copies finder items, changes them to jpeg, reveals them, and then runs an applescript that presents a dialog for batch resizing by image width. Every now and then, the script misses a couple of files or I prematurely move them from the folder before they have finished. I added a couple of pieces to the automation to

  1. Set value of variable: output
  2. Ask for confirmation: output

This doesn’t really output anything useful, but it does notify me when the script has finished running. Is there some way to output whether or not there were any issues with the script or is this way too crazy of a question to be asking on stackexchange? In advance… No, I’m not very familiar with AppleScript.

Here’s the script – I appreciate any & all advice/help 🙂

tell application "System Events"
    activate
    set theWidth to display dialog "Enter the width" default answer "2000"
    set theWidth to the text returned of theWidth as real
end tell
global theWidth
tell application "Finder"
    set some_items to selection as list
    repeat with aItem in some_items
        set contents of aItem to aItem as alias
    end repeat
end tell
repeat with i in some_items
    try
        rescale_and_save(i)
    end try
end repeat

to rescale_and_save(this_item)
    tell application "Image Events"
        launch
        set the target_width to theWidth
        -- open the image file
        set this_image to open this_item
        
        set typ to this_image's file type
        
        copy dimensions of this_image to {current_width, current_height}
        if current_width is greater than target_width then
            if current_width is greater than current_height then
                scale this_image to size target_width
            else
                -- figure out new height
                -- y2 = (y1 * x2) / x1
                set the new_height to (current_height * target_width) / current_width
                scale this_image to size new_height
            end if
        end if
        
        tell application "Finder"
            set file_name to name of this_item
            set file_location to (container of this_item as string)
            set new_item to (file_location & file_name)
            save this_image in new_item as typ
        end tell
    end tell
end rescale_and_save

google – How “Serious” is the Core Web Vitals update? All my competitors have the same results

I know that Google algo (publicly released) updates are just recommendations but how “seriously” are you taking Core Web Vitals update May 1st?

This is a rolling-update spread over a month, but my question is this: all our competitors (we are in mass/large-scale eCommerce) hover at the same bad results, basically all performing “badly” in the results (GMetrix and Google PageSpeed)….

Now, I know that there is a difference between “Lab” and “Field” data but still – how seriously should we be taking this?

We rank for half a million keywords and I can’t imagine us being knocked down the rankings because we score low on a lab-testing machine?

What are your thoughts?

sharepoint online – How do I error handle a REST API call with no results?

I have a PowerQuery function o retrieve the contents of a SharePoint list.

let
    Source = (url as any) => 
    let
        aSource = OData.Feed(url, null, (Implementation="2.0")),
    in
        #"aSource"
in
    Source

But sometimes the list doesn’t exist, and OData REST API calls don’t seem to have a nice set of HTTP type response codes. The code bombs out with a msg

OData version 3 and 4 Error The server returned an error: (404) Not found. (List 'ABC' does not exist at site ......)

But if I paste the URL into a browser, I get a XML response, with no HTTP error codes.

How to get all candidates / results from hashcat?

I use the following to get me the input values to a SHA256 hash output

sudo hashcat -a 0 -m1400 file_were_the_hash_is.txt list_of_passwords.txt

This seem to work fine. I however only get one candidate shown by hashcat. What am I missing to get all candidates, that my list_of_passwords.txt can create?

Modern PnP Search Box Refreshes Search Results Page 2-4 times

I have a PnP Modern v4 Search Bar on the homepage. I’m using the Method = Query string parameter and Parameter name = q (and tried k).

When I search, it redirects to my custom search page with Modern Search Results web part. The results are filtered based on my search query from before.

The problem is it loads the page initially and then reloads the page 2-4 more times. If use the Search Box on the custom search page and do a search, it doesn’t reload the page like from the homepage. Seems like the only difference I see is that from the homepage, I send to a custom page whereas from the custom search page, I stay on the page.