Category Archives: Error

[Solved] appium Error: A new session could not be created

Error reported in appium:

selenium. common. exceptions. SessionNotCreatedException: Message: A new session could not be created. (Original error: Command failed: C:\\WINDOWS\\system32\\cmd.exe /s /c “D:\\tools\\Android\\android-sdk\\platform-tools\\adb.exe -s 127.0.0.1:62001 shell “ps ‘uiautomator'””

Execute the command in the error message in CMD:

The error message reported is: bad PID ‘uiautomator’

Solution:

1. Find ADB. In the appium installation directory JS file, directory:\appium\node_modules\appium\node_Modules\appium-ADB\lib
2. Open ADB.JS, find the following code:

ADB.prototype.shell = function (cmd, cb) {
  if (cmd.indexOf('"') === -1) {
    cmd = '"' + cmd + '"';
  }
  var execCmd = 'shell ' + cmd;
  this.exec(execCmd, cb);
};

3. Add the following code below the above code

//add
ADB.prototype.shell_grep = function (cmd, grep, cb){
    if (cmd.indexOf('"') == -1){
        cmd = '"' + cmd + '"';
    }
    var execCmd = 'shell' + cmd + '| grep ' + grep;
    this.exec(execCmd, cb);
};

4. Find the following code:

ADB.prototype.getPIDsByName = function (name, cb) {
  logger.debug("Getting all processes with '" + name + "'");
  this.shell("ps '" + name + "'", function (err, stdout) {
    if (err) return cb(err);
    stdout = stdout.trim();
    var procs = [];
    var outlines = stdout.split("\n");
    _.each(outlines, function (outline) {
      if (outline.indexOf(name) !== -1) {
        procs.push(outline);
      }
    });
    if (procs.length < 1) {
      logger.debug("No matching processes found");
      return cb(null, []);
    }
    var pids = [];
    _.each(procs, function (proc) {
      var match = /[^\t ]+[\t ]+([0-9]+)/.exec(proc);
      if (match) {
        pids.push(parseInt(match[1], 10));
      }
    });
    if (pids.length !== procs.length) {
      var msg = "Could not extract PIDs from ps output. PIDS: " +
                JSON.stringify(pids) + ", Procs: " + JSON.stringify(procs);
      return cb(new Error(msg));
    }
    cb(null, pids);
  });
};

4. Comment out the above code, start with/* and end with */comment

5. Replace with the following code

//replace
ADB.prototype.getPIDsByName = function (name, cb) {
  logger.debug("Getting all processes with '" + name + "'");
  this.shell_grep("ps", name, function (err, stdout) {
    if (err) {
      logger.debug("No matching processes found");
      return cb(null, []);
    }
    var pids = [];
    _.each(procs, function (proc) {
    var match = /[^\t ]+[\t ]+([0-9]+)/.exec(proc);
    if (match) {
    pids.push(parseInt(match[1], 10));
    }
    });
    if (pids.length !== procs.length) {
      var msg = "Could not extract PIDs from ps output. PIDS: " +
      JSON.stringify(pids) + ", Procs: " + JSON.stringify(procs);
      return cb(new Error(msg));
    }
    cb(null, pids);
  });
};

6. Restart appium

[Solved] reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response

Jetty service used by backend

report errors

2022-01-11 17:20:24.362  WARN 4784 --- [ctor-http-nio-3] r.netty.http.client.HttpClientConnect    : [id: 0x3eaaea4e, L:0.0.0.0/0.0.0.0:58790 ! R:localhost/127.0.0.1:8090] The connection observed an error

reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response

2022-01-11 17:20:24.362 ERROR 4784 --- [ctor-http-nio-3] a.w.r.e.AbstractErrorWebExceptionHandler : [31e53fe7-21772]  500 Server Error for HTTP GET "/status"

reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response
	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Error has been observed at the following site(s):
	|_ checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain]
	|_ checkpoint ⇢ HTTP GET "/status" [ExceptionHandlingWebHandler]
Stack trace:

explain

Call the back-end service jetty through the gateway service spring cloud gateway and report an exception

reason

The back-end service automatically disconnects after the socket timeout, and the gateway service takes the disconnected connection from the httpclient connection pool to request

Reappearance

Spring Cloud GateWay : 2.2.1.RELEASE

Spring Cloud : Hoxton.SR1

Spring Boot : 2.3.4.RELEASE

Server uses springboot emulation

GateWay

spring:
  application:
    name: gateway
  cloud:
    gateway:
      httpclient:
        pool:
          max-idle-time: 60000ms
      routes:
      - id: dev
        uri: ${service-url.dev-service}/status
        predicates:
        - Path=/status
service-url:
  dev-service: http://localhost:8080
server:
  port: 8098

Server

spring:
  application:
    name: dev
server:
  tomcat:
    connection-timeout: 100ms

Jmeter

Threads:300
period seconds:5
Loop Count:20

explain:

Max idle time: maximum idle connection time

Connection timeout: timeout of socket read().

Gateway’s max idle time: the connection is released after 60000ms, and the connection timeout of the server is disconnected after 100ms. At this time, gateway will take the disconnected connection request from the connection pool, resulting in an error

 

Solution:

Because the server is the provider and the gateway is the consumer, try to ensure that the consumer disconnects before the provider, and the time for setting Max idle time is not greater than connection timeout

Jetty services

Jetty modified jetty.http.Idletimeout or http.timeout. Default 30000ms

 

Matplotlib.pyplot Plug-in Chinses Font Error: RuntimeWarning: Glyph 26376 missing from current font

Using Matplotlib When drawing with pyplot, add a Chinese font, which indicates that the font cannot be found. The solution is as follows

1. Download simhei Ttf (BOLD) font file;

2. Copy to D:\Python38\Lib\site-packages\matplotlib\mpl-data\fonts\ttf (My Catalog)

3. Modify the file D:\Python38\Lib\site-packages\matplotlib\mpl-data\matplotlibrc

 font.family         : sans-serif   
 # remove the previous #     
 font.sans-serif     : SimHei, Bitstream Vera Sans, Lucida Grande, Verdana, Geneva, Lucid, Arial, Helvetica, Avant Garde, sans-serif  
 # remove the previous #, and add SimHei after the colon
 axes.unicode_minus  : False
 # remove the previous #, and change the True to False

4. Add code

# set the font
plt.rcParams['font.sans-serif'] = ['KaiTi', 'SimHei', 'FangSong'] 
plt.rcParams['font.size'] = 12 
plt.rcParams['axes.unicode_minus'] = False

5. Delete the buffer directory of Matplotlib
in the python environment of the terminal, enter the following command to view the font cache path of Matplotlib:

import matplotlib
matplotlib.get_cachedir()

Then exit the python environment and delete the cache directory on the terminal using the RM - RF + path

6. The font configuration is completed and can be used normally

K8s binary deployment start API-server error: Error: unknown flag: –etcdservers

 systemctl status kube-apiserver  failed to startup

check the error in the log

cat /var/log/messages|grep kube-apiserver|grep -i error

Jan 11 11:22:44 m1 kube-apiserver: --logtostderr                      log to standard error instead of files
Jan 11 11:25:16 m1 kube-apiserver: Error: unknown flag: --etcdservers
Jan 11 11:25:16 m1 kube-apiserver: --alsologtostderr                  log to standard error as well as files
Jan 11 11:25:16 m1 kube-apiserver: --logtostderr    

【Error: unknown flag: --etcdservers】 that I wrote the wrong string.

I copied the pdf content of the textbook; --etcdservers copied out and pasted into notepad, and found that the [-] symbol was missing.

chrome browser copy pdf - line feed content to notepad++ less [-] symbol

so pay attention to the differences in copying content.

Successful startup after correction

[Solved] nginx Error: directory index of “/home/www/hexo/” is forbidden

Note: Recently, when setting up hexo, I finished all the work. I found that nginx reported 403 Forbidden. I checked the log of nginx

Log information is recorded as follows:

*481 directory index of “/home/www/hexo/” is forbidden~~~~~~

Solution: go to the configuration file nginx.conf in the nginx conf directory Conf plus configure autoindex on; Automatic indexing

Restart ngxin

Uncaught SyntaxError: Unexpected end of JSON input [How to Solve]

#Error description

The following error occurred while debugging the program:

This is a dynamically generated list. When clicking the list to migrate to the display content screen, the screen cannot be displayed normally and an error is reported. However, it is worth noting that not all lists have problems during migration, but only one has problems.

# findings

The number of JSON string fields exceeds the maximum limit. The final solution is to decompose the fields into two fields (in fact, it is equivalent to surrender). It seems that it may be the problem of string conversion from the background server (PHP) to JSON.

In short, after reducing the string length of the field, the problem can be solved temporarily.

# investigation means

Deleting part of the data and finally being confirmed is the problem of the data range, rather than the problem of individual characters guessed before the investigation.

How to Solve Unity2020 using Unity.Mathematics Error

First of all, this is because your project does not have this package, so where do you download the package?

Of course, it was downloaded from package manager, but it was not found after opening. What’s the matter?

Unity modified some package manager strategies in 2020.1. Packages in the early development stage and inactive development cannot be directly searched (even if show preview package is opened, it cannot be found, nor in the list)

So I want to download com unity. mathematics

First, open package manager

Click add package from git URL

Then send com unity. Click “Mathematics” and press “enter” to download automatically

After downloading, you can use it

Another situation is that there is an error in your vs, but there is no error on the unity console:

The solution is to modify the API compatibility level. Why you modify it is not important. You can modify it to 4.X is modified again. After modification, your vs can return to normal, using unity Mathematics, no more errors will be reported

[Solved] Error running ‘index’: Cannot run program “C:\Users\testgu\AppData\Local\Programs\Python\Python39\python.exe” (in directory “D:\PYWorkspace\ycyzharry”): CreateProcess error=2, the system cannot find the specified file.

When running python, the following errors are reported:

Error running ‘index’: Cannot run program “C:\Users\testgu\AppData\Local\Programs\Python\Python39\python.exe” (in directory “D:\PYWorkspace\ycyzharry”): CreateProcess error=2, the system cannot find the specified file.

Solution:

Pychar found “file” -> “Settings” -> “Project:XXX” -> “Python interpreter”

Select the corresponding Python version and apply

[Solved] error C4430: missing type specifier – int assumed. Note: C++ does not support default-int

Error generating in VS2008: error c4430: missing type specifier – int assumed Note: C++ does not support default-int

This is because in VC6, if the specified return value type is not displayed, the compiler treats it as the default integer. However, VS2005 does not support default integers.

Solution:
open the project – project properties – configuration properties – C/C + + – command line, and add the /wd4430 option to the additional options.