Category Archives: Error

[Solved] Kafka Start Log Error: WARN Found a corrupted index file due to requirement failed: Corrupt index found

Go straight to the theme, and the personal test is effective!!

Error content

WARN Found a corrupted index file due to requirement failed: Corrupt index found   A corrupt index file was found and the request failed

WARN Found a corrupted index file due to requirement failed: Corrupt index found, index file (/tmp/kafka-logs/__consumer_offsets-13/00000000000000000000.index) has non-zero size but the last offset is 0 which is no larger than the base offset 0.}. deleting /tmp/kafka-logs/__consumer_offsets-13/00000000000000000000.timeindex, /tmp/kafka-logs/__consumer_offsets-13/00000000000000000000.index, and /tmp/kafka-logs/__consumer_offsets-13/00000000000000000000.txnindex and rebuilding index... (kafka.log.Log)
[2021-11-27 10:02:24,168] INFO Recovering unflushed segment 0 in log __consumer_offsets-13. (kafka.log.Log)
[2021-11-27 10:02:24,168] INFO Loading producer state from offset 0 for partition __consumer_offsets-13 with message format version 2 (kafka.log.Log)
[2021-11-27 10:02:24,169] INFO Completed load of log __consumer_offsets-13 with 1 log segments, log start offset 0 and log end offset 0 in 2 ms (kafka.log.Log)
[2021-11-27 10:02:24,172] WARN Found a corrupted index file due to requirement failed: Corrupt index found, index file (/tmp/kafka-logs/test-0/00000000000000000000.index) has non-zero size but the last offset is 0 which is no larger than the base offset 0.}. deleting /tmp/kafka-logs/test-0/00000000000000000000.timeindex, /tmp/kafka-logs/test-0/00000000000000000000.index, and /tmp/kafka-logs/test-0/00000000000000000000.txnindex and rebuilding index... (kafka.log.Log)

Error reporting reason

The Kafka broker is abnormally closed and stopped, resulting in index corruption

Solutions

Step 1:   Enter the Kafka home directory of your installation and execute the following command to view the storage directory of Kafka data (Kafka log configuration)

vim config/server.properties

Step 2: directly delete the/TMP/Kafka LOHS folder

rm -rf /tmp/kafka-logs/

Result verification

Restart Kafka and check the log to verify that the problem has been solved

Check the Kafka log and confirm that the error has been resolved


To solve the problem, a problem is derived

deleting the Kafka data file is equivalent to starting Kafka for the first time. When you start up with the zookeeper provided by Kafka, you may report an error by viewing logs/zookeeper.out under the log information.

[Solved] Websocket Error: WebSocket is already in CLOSING or CLOSED state

When the front-end project communicates with the back-end Java websocket for a long time, sometimes the browser will report an error

WebSocket is already in CLOSING or CLOSED state.

This problem may be caused by the data length passed by websocket being greater than 8192   After websocket establishes a connection, the length of JSON passed should be & lt= 8192, otherwise an error will be reported    Websocket is already in closing or closed state.

1. At this point, we can add some code in web.xml to limit the parameter length limit in websocket.

# Limit WebSocket pass data size to 50M
<context-param>
         <param-name>org.apache.tomcat.websocket.textBufferSize</param-name>
         <param-value>5242800</param-value>
</context-param>

<context-param>
         <param-name>org.apache.tomcat.websocket.binaryBufferSize</param-name>
         <param-value>5242800</param-value>
</context-param>

After adding the above code, you can modify the size and length of the transfer parameters of websocket, which is limited to 50m.

2. The above method is not available for the springboot project because there is no web.xml file in the project directory. At this time, we can put the following code into the springboot project under the context directory of the project (or create a new code class or block at will)

import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.util.WebAppRootListener;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;

/**
 * Add WebSocket pass data size limit of 50M
 */
@Configuration
@ComponentScan
@EnableAutoConfiguration
public class WebSocketConfig implements ServletContextInitializer {

    //Configure websocket transfer size, 50M
    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        servletContext.addListener(WebAppRootListener.class);
        servletContext.setInitParameter("org.apache.tomcat.websocket.textBufferSize","52428800");
        servletContext.setInitParameter("org.apache.tomcat.websocket.binaryBufferSize","52428800");
    }
}

The above code can solve the problem of websocket is already in closing or closed state

You can successfully modify the size limit of websocket transmission data to 50m.

Note: a problem was found during use. If the above configuration is started with the built-in Tomcat in springboot, there is no problem, but the operation using the external Tomcat after war does not take effect. Finally, it is found that the problem is due to the external Tomcat version. The problem version is tomcat8.0.xx, but there is no problem using tomcat8.5.xx

[Solved] Android 12 error: Manifest merger failed : android:exported needs to be explicitly specified for .

Error Messages:
Manifest merger failed : android:exported needs to be explicitly specified for <activity>. Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined.

 

Solution:
1.AndroidManifest.xml set according to the following document, Not Work.
https://developer.android.com/guide/topics/manifest/activity-element#exported
2. Not Work
3. Modify the parameters in the red box under the premise of the above operation, Worked!

[Solved] Gitee generates public key error: Enter file in which to save the key…

Directly report an error using a local command prompt:
Enter file in which to save the key (C:\Users\files?.ssh/id_ed25519): Could not create directory 'C:\\Users\\\346\236\227\346\265\251\345\256\217/.ssh': Invalid argument Enter passphrase (empty for no passphrase): Enter same passphrase again: Saving key "C:\\Users\\\346\236\227\346\265\251\345\256\217/.ssh/id_ed25519" failed: No such file or directory

 


Solution: Press shiftjian + right click under the corresponding file, select git to open it, and use git to generate

[Solved] C + + compile Error: error: default argument given for parameter 3

1. error: default argument given for parameter 3 of ‘void split(const string&, std::vector<std::__cxx11::basic_string<char> >&, char)’ [-fpermissive]
void split(const std::string &s, std::vector<std::string> &sv, const char flag = ‘ ‘)
^
In file included from /home/zhouying/lcl/test/FotaService/src/util.cpp:5:0:
/home/zhouying/lcl/test/FotaService/include/util.h:6:6: note: previous specification in ‘void split(const string&, std::vector<std::__cxx11::basic_string<char> >&, char)’ here
void split(const std::string &s, std::vector<std::string> &sv, const char flag = ‘ ‘);

 

Cause: The third formal parameter in the header file util.h is set to the default value, and the third formal parameter in the function definition in util.cpp is set to the default value, resulting in preservation, delete the third formal parameter default value in the function definition in util.cpp

.net socket programming error [How to Solve]

The development of a C/s project involves the problem of regular reconnection of the client after the server is stopped. During the development process, an error is reported as follows:

After the socket is disconnected, it can only be reconnected asynchronously, and can only be connected to different endpoints.   Beginconnect must be called on the thread that will not exit before the operation is completed.

After searching for relevant information on the Internet, the problem was not solved. A whim occurred and the universal list type was used to solve the problem. The methods are as follows:

Add global variables first

Private _Socket As New List(Of Socket)

Add several more in the process of connection_ Socket.Clear():

Private Sub ConnectServer()
        _Socket.Clear()
        Dim SockClient As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) 
        _Socket.Add(SockClient)
        Dim Address As IPAddress = IPAddress.Parse(_ServerIPString)
        Dim Endpoint As New IPEndPoint(Address, _ServerPort)
        Try 'Catching exceptions
            _Socket(0).Connect(Endpoint) 'initiate the connection, where the first index in the List is used instead of the local SockClient
        Catch ss As SocketException
            Dim strErrorMsg As String = ss.SocketErrorCode.ToString
            strErrorMsg = strErrorMsg.Replace("TimedOut", "Connection timeout!")
            strErrorMsg = strErrorMsg.Replace("ConnectionRefused", "Connection rejected!")
            If SockClient.Connected Then SockClient.Close()
            _Socket.Clear()
            MessageBox.Show(strErrorMsg, "Connection exception", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Return
        Catch s As Exception
            If SockClient.Connected Then SockClient.Close()
            _Socket.Clear()
            MessageBox.Show(s.Message, "exception", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Return
        End Try

End Sub

be accomplished

Test results:

After repeatedly disconnecting the server, call the connectserver process again to connect again. The connection is successful and no error is reported.

Quartus compile error: Error (10170): Verilog HDL syntax error at Verilog1.v(8)

Codes:
module adder(
input [31:0] operand1,
input [31:0] operand2,
input cin,
output [31:0] result,
output cout
);
assign {cout,result} = operand1 + operand2 + cout;
endmodule

 

Error Messages:

Error (10170): Verilog HDL syntax error at Verilog1.v(8) near text: “cout”; expecting “highz0”, or “highz1”, or “large”, or “medium”, or “pull0”, or “pull1”, or “small”, or “strong0”, or “strong1”, or “supply0”, or “weak0”, or “weak1”. Check for and fix any syntax errors that appear immediately before or at the specified keyword. The Intel FPGA Knowledge Database contains many articles with specific details on how to resolve this error. Visit the Knowledge Database at https://www.altera.com/support/support-resources/knowledge-base/search.html and search for this specific error message number.
Error (10759): Verilog HDL error at Verilog1.v(8): object result declared in a list of port declarations cannot be redeclared within the module body
Error (10112): Ignored design unit “adder” at Verilog1.v(1) due to previous errors
Error: Quartus Prime Analysis & Synthesis was unsuccessful. 3 errors, 1 warning
Error: Peak virtual memory: 4702 megabytes
Error: Processing ended: Sat Nov 27 15:57:22 2021
Error: Elapsed time: 00:00:12
Error: Total CPU time (on all processors): 00:00:27
Error (293001): Quartus Prime Full Compilation was unsuccessful. 5 errors, 1 warning


Solution:

Select the option in the red box.

Done!

Android Error: META-INF/DEPENDENCIES [How to Solve]

3 files found with path ‘META-INF/DEPENDENCIES’.
Adding a packagingOptions block may help, please refer to
https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.PackagingOptions.html
for more information

Probably means: Error: Multiple files found in OS independent path ‘META-INF/DEPENDENCIES’
Solution:
Add to the build.gradle where the problem occurs

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
}

The general principle is:

In Android gradle construction, it is not allowed to include the same file with the same path in the output multiple times. In your construction, there are two meta-inf/dependencies files from different places. Since your application does not need this file at all, the easiest way is to tell the construction system to ignore it completely, which is the role of the exclude instruction

Another PickFirst instruction tells the build system to keep one copy; There are some details in Android gradle plug-in 0.7.0: “duplicate files during APK packaging”

[Solved] OpenCV VideoWriter Error: FFMPEG: tag ‘MP4V‘ is not supported with codec id 12 and format mp4

1. Problem code

A few months ago, a piece of code could be executed normally. Some of the codes are as follows:

def buildVideoByCV():
    videoMake = cv2.VideoWriter()
    fourcc = cv2.VideoWriter_fourcc(*'MP4V') #https://blog.csdn.net/whudee/article/details/108689420
    fps = 12
    videoMake.open(r"g:\video\lightShowCV.MP4", fourcc, fps, (800,600))

    for t in range(65*fps):
        img = makeframe(t*1.0/fps)
        videoMake.write(img)
        if t%20==0:print(f'\r视频制作进度:{(t*100.0)/(66*fps):4.2f}%',end='')
    videoMake.release()

2. Error message

Error in execution today:

Video production progress: 95.96%OpenCV: FFMPEG: tag 0x5634504d/'MP4V' is not supported with codec id 12 and format 'mp4/MP4 (MPEG-4 Part 14)'
OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'

3. Solution

Set FourCC = cv2.videowriter_FourCC (*'mp4v') is changed to: FourCC = CV2.Videowriter_FourCC (*'mp4v') , just change the encoded uppercase mp4v to lowercase.

4. Summary

This paper introduces the solution to the error reported by opencv videowriter: ffmpeg: tag ‘mp4v’ is not supported. You only need to replace the code ‘mp4v’ with ‘mp4v’.