Author Archives: Robins

[Solved] websocket error in Linux service: / lib64 / libc. So. 6: version ` glibc_2.17‘ not found

1.Error reporting
after the websocket service is installed on the server,
when viewing the log, the following error messages are found:
/lib64/libc. So. 6: version ` glibc_ 2.17’ not found (required by ./node)

It shows that the version of a plug-in in the Lib library does not exist

2.Solution
1. View the glibc version available in the system

// Use the strings command to view
strings /lib64/libc.so.6 |grep GLIBC_
// View the results as follows.
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_PRIVATE

As can be seen from the figure, there is no glibc_ Version 2.17 of glibc library, so you need to download a newer version of glibc library.

2. Download a new version of glibc library
https://ftp.gnu.org/gnu/glibc/glibc-2.17.tar.gz
Or through

wget https://ftp.gnu.org/gnu/glibc/glibc-2.17.tar.gz
# Unpack the tarball
tar -xvf glibc-2.17.tar.gz

3. Compile and install

# 1. Go to the glibc-2.17 directory
cd glibc-2.17
# 2. Create the build directory
mkdir build
# 3. Go into the build directory
cd build
# 4, execute . /configure
... /configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
# 5. Install
make && make install

4. View shared libraries

ls -l /lib64/libc.so.6
=====================
// You can see that the soft link has been created
lrwxrwxrwx. 1 root root 12 Jan 13 01:49 /lib64/libc.so.6 -> libc-2.17.so

5. Review the glibc version in the system again

[root@localhost ~]# strings /lib64/libc.so.6 |grep GLIBC_
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17
GLIBC_PRIVATE

It can be found that it is the latest version

6. Check the log again and find that the original error has been solved ~

Python environment error, bad interpreter: there is no file or directory

[xxxx@gs-server-7214 ~]$ /opt/anaconda3/bin/jupyter notebook
-bash: /opt/anaconda3/bin/jupyter: /opt/anaconda3/bin/python: Bad interpreter: No that file or directory
[xxxx@gs-server-7214 ~]$ /opt/anaconda3/bin/python3
Python 3.6.10 |Anaconda, Inc.| (default, May  8 2020, 02:54:21)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
[1]+  Stop               /opt/anaconda3/bin/python3

    1. create a soft connection
    1. Jupiter has been installed through

/opt/anaconda3/bin/python3 - M PIP install Jupiter

    1. , and python can also be started under the full path, but the error is reported as above when starting Jupiter under the full path. The reason is that the default interpreter path of anaconda is/opt/anaconda3/bin/python, but there is no such file, Create a soft connection Python to point to the actual interpreter Python 3.6, as follows

- & gt</ Code> indicates soft connection </ OL>

[xxxx@gs-server-7214 bin]$ ll |grep python
-rwxrwxr-x 1 root root      237 10月 24 2019 ipython
-rwxrwxr-x 1 root root      237 10月 24 2019 ipython3
lrwxrwxrwx 1 root root        9 7月  16 16:31 python -> python3.6
lrwxrwxrwx 1 root root        9 8月  28 2020 python3 -> python3.6
-rwxrwxr-x 1 root root 11947112 5月   8 2020 python3.6
lrwxrwxrwx 1 root root       17 8月  28 2020 python3.6-config -> python3.6m-config
lrwxrwxrwx 1 root root        9 8月  28 2020 python3.6m -> python3.6
-rwxrwxr-x 1 root root     3477 8月  28 2020 python3.6m-config
lrwxrwxrwx 1 root root       17 8月  28 2020 python3-config -> python3.6m-config

2. Set the environment variable
and modify the . Bash in your user directory_ Profile file, add environment variable, export path =/opt/anaconda3/bin: $path , colon is separatorsource .bash_ Profile makes the environment variable effective, so you can start jupyter by directly entering jupyter notebook in your user directory.

[Solved] Selenium error: staleelementreferenceexception exception

StaleElementReferenceException

Problem reporting and solution

Problem reporting error

# clcik to the next page
web.find_element_by_xpath('//*[@id="nexthehe"]').click()

the element is no longer attached to the DOM : the element is no longer attached to the dom

Solution:

The element is no longer attached to the dom

Analyze the cause

It is possible that elements that are no longer attached to the DOM tree are guided (for example, document. Documentelement)

But the page content is not loaded and cannot be found

resolvent:

Still, looking for the element again

try:
    # clcik to the next page
    web.find_element_by_xpath('//*[@id="nexthehe"]').click()
    # time.sleep(1)
except Exception:
    print('failed to next page')
    web.find_element_by_xpath('//*[@id="nexthehe"]').click()

if a proxy or similar is necessary `net.git-fetch-with-cli`, Rust Complete `Couldn‘t resolve host name (Coul

linux rust download dependency error
if a proxy or similar is necessary net.git-fetch-with-cli
Create config in cargo
vi ~/.cargo/config
1
add proxy

[http]
proxy = "127.0.0.1:7891"
[https]
proxy = "127.0.0.1:7891"

Or modify the download warehouse

[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = 'ustc'
[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"

Pro test, modify and download the warehouse.

Solution to the error in compiling couldn't resolve host name (could not resolve host: Crites) by rust

When compiling the rust source program, the following couldn’t resolve host name (couldn’t resolve host: Crites) errors may occur (see https://github.com/ustclug/discussions/issues/294 )。

A temporary solution is to add the environment variable cargo when running cargo_ HTTP_ MULTIPLEXING=false。 The function is to cancel parallel downloads. For specific reasons, please refer to the error report of building rustc after using the image.

Pro test passed!

Python Redis: How to batch fuzzy Delete Keys

The method is as follows:

    # redis connection, chain refers to the test environment Redis environment
    r = redis.Redis(host='localhost', port=7622, db=0, decode_responses=True)

    item_list = r.keys(pattern='*app_access##qa_press_test*')
    
    # need to determine if there is a matching value, if not, it will report an error, so need to determine the processing
    if len(item_list):
        # Batch delete all cached application keys
        r.delete(*r.keys(pattern='app_access*'))
        logger.info("clear success...")
    else:
        logger.warn("with no data need to delete...")

PS: there is a detail to note here, that is, deleting directly without matching data will report an error, which needs to be handled

Note: conn.keys (‘test ‘) returns a list matching the corresponding pattern. Through the * sign, you can see that the parameters in the delete () method use variable parameters, that is, you can pass in a variable number of key values and delete them all.

[Solved] RuntimeError: No application found. Either work inside a view function or push an application contex

Python + Flash + Flash Sqlalchemy to realize MySQL database operation

Write test cases in Python to realize MySQL query

The test cases are as follows:

class MySQLTest(unittest.TestCase):

  def test_queryAll(self):
      uas = db.session.query(UserAgent).all()
      self.assertIsNotNone(uas)

      for ua in uas:
        print("\n")
        print(ua)


if __name__ == '__main__':
  unittest.main()

1、 Problem description

Error message below

RuntimeError: No application found. Either work inside a view function or push an application context. See http://flask-sqlalchemy.pocoo.org/contexts/.

If no application is found, either work in the view function or push the application context

The first reaction should be related to writing test cases in Java Web applications, and the application context cannot be found


2、 Problem analysis

The test case starts a thread to execute database operation separately, which is independent of the flash application. It is unable to obtain the configuration information of the flash application context (including database connection information), so it is necessary to push the application context (inject context object)

This is why it works in the view function, which runs in the web container of flash.


3、 Solution

Python uses the with statement to manage context

The with statement is essentially context management
1. Context management protocol. Inclusion method__ enter__() And exit (), which support the protocol object to implement these two methods
2. The context manager defines the runtime context to be established when executing the with statement, and is responsible for executing the entry and exit operations in the context of the with statement block
3. Execute when entering the context__ enter__ Method. If the as var statement is set, the VaR variable accepts__ enter__() Method returns a value
4. If an exception occurs during runtime, exit the context manager. Call manager__ exit__ method.

Push the application context, that is, at the top where the thread starts executing code,
add with app.app_ context():

class MySQLTest(unittest.TestCase):

  def test_queryAll(self):
    with app.app_context():
      uas = db.session.query(UserAgent).all()
      self.assertIsNotNone(uas)

      for ua in uas:
        print("\n")
        print(ua)


if __name__ == '__main__':
  unittest.main()

4、 Result verification

Add with app.app_Context():
just write your own program logic, and the test case runs successfully

Gitlab Reconfigure is Stuck ruby_block[wait for redis service socket] action run

Gitlab is stuck in Ruby_ block[wait for redis service socket] action run

Environment: Ubuntu 20

When installing gitlab , execute sudo gitlab CTL reconfigure , and get stuck in this place when the /etc/gitlab/gitlab.rb file is installed

Insert a picture description here

and wait for a long time, but you don’t see any change in the log information output from the console.

Solution:
open another terminal and start the following command

sudo /opt/gitlab/embedded/bin/runsvdir-start

Or execute the above command in the background in the current terminal window

nohup /opt/gitlab/embedded/bin/runsvdir-start &

Then execute

sudo gitlab-ctl reconfigure

Json: struct field readyReplicas has json tag but is not exported [How to Solve]

type MeshStatus struct {
	// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
	// Important: Run "make" to regenerate code after modifying this file
	AvailableReplicas int `json:"available_replicas,omitempty"`
	readyReplicas     int `json:"ready_replicas,omitempty"`
	Replicas          int `json:"replicas,omitempty"`
}

error: struct field readyReplicas has json tag but is not exported
Cause of the error readyReplicas does not have a capitalization at the beginning ReadyReplicas

[Solved] error while loading shared libraries: libmpc.so.3: cannot open shared object file

1. You can try to install this dependency first, and then try to compile whether it can be compiled normally

apt-get --reinstall install libmpc3

2. If it still doesn’t work, you can check whether there is this file in your compilation package path, or whether there is this file in other paths. If so, open the file with VI and insert a line below your path

sudo vi /etc/ld.so.conf

For example, mine is/opt/usr/lib

and then refresh

sudo ldconfig

[Solved] mysqli::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers in

This problem is caused by too low PHP version + too high MYSQL version

MYSQL8.0+ version introduces a new character set utf8mb4 

Change the old utf8 alias to utf8mb3

The old PHP’s MYSQLND module does not include the new character set

 

So there will be

The solution is simple, just upgrade to a new PHP version

Official https://bugs.php.net/bug.php?id=74461

Written

 

[2018-05-02 12:13 UTC] [email protected]

[2018-05-02 17:37 UTC] macleo at outlook dot com

So the 7.0+ version is basically OK

 

 

 

[Solved] FFMPEG live encoding 2. session more error: [nvenc @ 0xa00480] OpenEncodeSessionEx failed: 0xa – invalid license key?

This problem occurs because Nvidia’s official restrictions
limit 2 concurrent processing tasks for different desktop-level products. For

detailed restrictions on each product, please refer to
https://developer.nvidia.com/video-encode-decode-gpu -support-matrix#Encoder

We can remove this restriction through the following patch

Start ffmpeg

The above picture has started 4 ffmpeg HW transcoding processes, and there is no error message

. Special attention needs to be paid here. The graphics card memory used by the control process should not exceed the total graphics card memory. If it exceeds, there will be frame loss, green screen and other problems

As shown in the figure, our RTX 2070 Super has 8G video memory, and 4 processes take up 10% or so, so according to 400/process, the maximum of about 18-20 processes can be enabled.