Explore all Socket open source software, libraries, packages, source code, cloud functions and APIs.

Popular New Releases in Socket

monolog

2.5.0

libuv

socket.io-client-java

2.0.1

go-socket.io

Changes API redis adapter with backward compatibility

Vue-Socket.io

Vue-Socket.io 3.0.10

Popular Libraries in Socket

monolog

by Seldaek doticonphpdoticon

star image 19584 doticonMIT

Sends your logs to files, sockets, inboxes, databases and various web services

libuv

by libuv doticoncdoticon

star image 19048 doticonNOASSERTION

Cross-platform asynchronous I/O

socket.io-client-java

by socketio doticonjavadoticon

star image 4746 doticonNOASSERTION

Full-featured Socket.IO Client Library for Java, which is compatible with Socket.IO v1.0 and later.

log.io

by NarrativeScience doticontypescriptdoticon

star image 4483 doticonNOASSERTION

Real-time log monitoring in your browser

Flask-SocketIO

by miguelgrinberg doticonpythondoticon

star image 4375 doticonMIT

Socket.IO integration for Flask applications.

go-socket.io

by googollee doticongodoticon

star image 4127 doticonNOASSERTION

socket.io library for golang, a realtime application framework.

Vue-Socket.io

by MetinSeylan doticonjavascriptdoticon

star image 3601 doticonMIT

😻 Socket.io implementation for Vuejs and Vuex

project_chat_application

by adrianhajdin doticonjavascriptdoticon

star image 3058 doticon

This is a code repository for the corresponding YouTube video. In this tutorial we are going to build and deploy a real time chat application. Covered topics: React.js, Node.js, Express.js, and Socket.io.

SuperSocket

by kerryjiang doticoncsharpdoticon

star image 3014 doticonApache-2.0

SuperSocket is a light weight, cross platform and extensible socket server application framework.

Trending New libraries in Socket

tuixue.online-visa

by Trinkle23897 doticonpythondoticon

star image 294 doticon

https://tuixue.online/visa/ A Real-time Display of U.S. Visa Appointment Status Website 预约美帝签证各个签证处最早时间的爬虫

iouring-go

by Iceber doticongodoticon

star image 166 doticonMIT

Provides easy-to-use async IO interface with io_uring

larastreamers

by christophrumpel doticonphpdoticon

star image 163 doticon

There is no better way to learn than by watching other developers code live. Find out who is streaming next in the Laravel world.

local-party

by sheldor1510 doticonjavascriptdoticon

star image 150 doticonApache-2.0

A website where you can create rooms and chat while watching local video files synchronized with your friends.

console-chat

by Grew-dev doticonjavascriptdoticon

star image 133 doticon

consolechat.io source codes

console-chat

by ihmissuti doticonjavascriptdoticon

star image 133 doticon

consolechat.io source codes

real-time-tweet-stream

by bradtraversy doticonjavascriptdoticon

star image 120 doticon

Get real-time tweets and display on webpage with socket.io

video-chat-v1

by itstaranarora doticonjavascriptdoticon

star image 88 doticon

A Video Chat app build with NodeJS, Express, Peerjs, Socket.io

peanutgredis

by realpeanut doticongodoticon

star image 79 doticon

使用golang socket 实现的redis客户端,遵循redis标准协议,本项目主要想通过自己实现redis客户端来学习redigo、io、bufio、strconv、sync源码,学习为主,源码阅读将放在https://github.com/realpeanut/golangSourceCodeRead 项目

Top Authors in Socket

1

socketio

8 Libraries

star icon13079

2

melardev

6 Libraries

star icon24

3

shokai

5 Libraries

star icon67

4

ziyasal

4 Libraries

star icon96

5

darrachequesne

4 Libraries

star icon34

6

clue

4 Libraries

star icon642

7

Big-Silver

4 Libraries

star icon34

8

nkzawa

4 Libraries

star icon594

9

jacking75

4 Libraries

star icon74

10

Atinux

3 Libraries

star icon11

1

8 Libraries

star icon13079

2

6 Libraries

star icon24

3

5 Libraries

star icon67

4

4 Libraries

star icon96

5

4 Libraries

star icon34

6

4 Libraries

star icon642

7

4 Libraries

star icon34

8

4 Libraries

star icon594

9

4 Libraries

star icon74

10

3 Libraries

star icon11

Trending Kits in Socket

Here are some of the famous Swift Socket Libraries. The use cases of these libraries include Developing Custom Network Applications, Developing Server-Side Applications, Developing Streaming Applications, Developing Peer-to-Peer Applications, and Developing Distributed Applications. 


Swift Socket Libraries are libraries written in the Swift language that provide an interface for applications to communicate over a network. These libraries allow developers to create custom networking applications that are capable of sending and receiving data over the internet. They provide an easy-to-use interface for developers to create powerful applications that can interact with other computers, servers, and services.


Let us look at some of these famous libraries. 

Staescream

  • Supports WebSocket compression, which reduces the amount of data sent over the wire.
  • Provides methods to read and write data to the socket connection easily. 
  • Supports both TCP and UDP connections.

swift-nio

  • Provides a non-blocking IO model, allowing high scalability and performance.  
  • Supports many protocols, including HTTP, HTTPS, WebSockets, and more.  
  • Supports reactive programming, allowing developers to write asynchronous code more efficiently

SwiftSocket

  • Supports IPv4 and IPv6, as well as TLS/SSL encryption.
  • Provides a well-documented API, making it easy to integrate into your existing Swift projects.
  • Supports multiple platforms including iOS, macOS, tvOS, and watchOS.

SwiftWebSocket

  • Provides a fast and lightweight WebSocket client written in Swift.
  • Provides real-time diagnostics and debugging features, including logging and message tracing.
  • Provides full control over message headers and payloads.

BlueSocket

  • Highly customizable, it allows developers to customize the features of their network protocols and sockets.
  • Implements all the latest security protocols, such as TLS 1.3 and WebSockets, to protect users' data.
  • Has built-in support for IPv6, allowing developers to create applications easily. 

sockets

  • Provides a flexible way to configure socket options.
  • Provides secure communication between client and server with encryption and authentication.
  • Provides high performance and low latency for data transfers.

JustLog

  • Offers a unique feature called "context switching," which allows developers to switch between different networks while their application runs. 
  • Provides an efficient asynchronous architecture which makes it easy to manage multiple connections. 
  • Supports real-time data synchronization with the help of an efficient and reliable protocol. 

Trending Discussions on Socket

EmbeddedKafka failing since Spring Boot 2.6.X : AccessDeniedException: ..\AppData\Local\Temp\spring.kafka*

Log4j vulnerability - Is Log4j 1.2.17 vulnerable (was unable to find any JNDI code in source)?

My project doesn't compile with optimization parameters after upgrading from angular 11 to angular 12

How to give certificate to Java Websocket?

Docker error: standard_init_linux.go:228: exec user process caused: exec format error

Wrong PHP version used when installing composer with Alpine's apk command

Can't listen to event sent from feathers server to client

Cypress Test Runner unexpectedly exited via a exit event with signal SIGSEGV in circleCI

localhost:5000 unavailable in macOS v12 (Monterey)

Running Cypress on WSL

QUESTION

EmbeddedKafka failing since Spring Boot 2.6.X : AccessDeniedException: ..\AppData\Local\Temp\spring.kafka*

Asked 2022-Mar-25 at 12:39

e: this has been fixed through Spring Boot 2.6.5 (see https://github.com/spring-projects/spring-boot/issues/30243)

Since upgrading to Spring Boot 2.6.X (in my case: 2.6.1), I have multiple projects that now have failing unit-tests on Windows that cannot start EmbeddedKafka, that do run with Linux

There is multiple errors, but this is the first one thrown

1...
2  .   ____          _            __ _ _
3 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
4( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
5 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
6  '  |____| .__|_| |_|_| |_\__, | / / / /
7 =========|_|==============|___/=/_/_/_/
8 :: Spring Boot ::                (v2.6.1)
9
102021-12-09 16:15:00.300  INFO 13864 --- [           main] k.utils.Log4jControllerRegistration$     : Registered kafka:type=kafka.Log4jController MBean
112021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     : 
122021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     :   ______                  _                                          
132021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     :  |___  /                 | |                                         
142021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     :     / /    ___     ___   | | __   ___    ___   _ __     ___   _ __   
152021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     :    / /    / _ \   / _ \  | |/ /  / _ \  / _ \ | '_ \   / _ \ | '__|
162021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     :   / /__  | (_) | | (_) | |   <  |  __/ |  __/ | |_) | |  __/ | |    
172021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     :  /_____|  \___/   \___/  |_|\_\  \___|  \___| | .__/   \___| |_|
182021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     :                                               | |                     
192021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     :                                               |_|                     
202021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     : 
212021-12-09 16:15:00.422  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     : Server environment:zookeeper.version=3.6.3--6401e4ad2087061bc6b9f80dec2d69f2e3c8660a, built on 04/08/2021 16:35 GMT
222021-12-09 16:15:00.422  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     : Server environment:host.name=host.docker.internal
232021-12-09 16:15:00.422  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     : Server environment:java.version=11.0.11
242021-12-09 16:15:00.422  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     : Server environment:java.vendor=AdoptOpenJDK
25...
262021-12-09 16:15:01.015  INFO 13864 --- [nelReaper-Fetch] lientQuotaManager$ThrottledChannelReaper : [ThrottledChannelReaper-Fetch]: Starting
272021-12-09 16:15:01.015  INFO 13864 --- [lReaper-Produce] lientQuotaManager$ThrottledChannelReaper : [ThrottledChannelReaper-Produce]: Starting
282021-12-09 16:15:01.016  INFO 13864 --- [lReaper-Request] lientQuotaManager$ThrottledChannelReaper : [ThrottledChannelReaper-Request]: Starting
292021-12-09 16:15:01.017  INFO 13864 --- [trollerMutation] lientQuotaManager$ThrottledChannelReaper : [ThrottledChannelReaper-ControllerMutation]: Starting
302021-12-09 16:15:01.037  INFO 13864 --- [           main] kafka.log.LogManager                     : Loading logs from log dirs ArraySeq(C:\Users\ddrop\AppData\Local\Temp\spring.kafka.bf8e2b62-a1f2-4092-b292-a15e35bd31ad18378079390566696446)
312021-12-09 16:15:01.040  INFO 13864 --- [           main] kafka.log.LogManager                     : Attempting recovery for all logs in C:\Users\ddrop\AppData\Local\Temp\spring.kafka.bf8e2b62-a1f2-4092-b292-a15e35bd31ad18378079390566696446 since no clean shutdown file was found
322021-12-09 16:15:01.043  INFO 13864 --- [           main] kafka.log.LogManager                     : Loaded 0 logs in 6ms.
332021-12-09 16:15:01.043  INFO 13864 --- [           main] kafka.log.LogManager                     : Starting log cleanup with a period of 300000 ms.
342021-12-09 16:15:01.045  INFO 13864 --- [           main] kafka.log.LogManager                     : Starting log flusher with a default period of 9223372036854775807 ms.
352021-12-09 16:15:01.052  INFO 13864 --- [           main] kafka.log.LogCleaner                     : Starting the log cleaner
362021-12-09 16:15:01.059  INFO 13864 --- [leaner-thread-0] kafka.log.LogCleaner                     : [kafka-log-cleaner-thread-0]: Starting
372021-12-09 16:15:01.224  INFO 13864 --- [name=forwarding] k.s.BrokerToControllerRequestThread      : [BrokerToControllerChannelManager broker=0 name=forwarding]: Starting
382021-12-09 16:15:01.325  INFO 13864 --- [           main] kafka.network.ConnectionQuotas           : Updated connection-accept-rate max connection creation rate to 2147483647
392021-12-09 16:15:01.327  INFO 13864 --- [           main] kafka.network.Acceptor                   : Awaiting socket connections on localhost:63919.
402021-12-09 16:15:01.345  INFO 13864 --- [           main] kafka.network.SocketServer               : [SocketServer listenerType=ZK_BROKER, nodeId=0] Created data-plane acceptor and processors for endpoint : ListenerName(PLAINTEXT)
412021-12-09 16:15:01.350  INFO 13864 --- [0 name=alterIsr] k.s.BrokerToControllerRequestThread      : [BrokerToControllerChannelManager broker=0 name=alterIsr]: Starting
422021-12-09 16:15:01.364  INFO 13864 --- [eaper-0-Produce] perationPurgatory$ExpiredOperationReaper : [ExpirationReaper-0-Produce]: Starting
432021-12-09 16:15:01.364  INFO 13864 --- [nReaper-0-Fetch] perationPurgatory$ExpiredOperationReaper : [ExpirationReaper-0-Fetch]: Starting
442021-12-09 16:15:01.365  INFO 13864 --- [0-DeleteRecords] perationPurgatory$ExpiredOperationReaper : [ExpirationReaper-0-DeleteRecords]: Starting
452021-12-09 16:15:01.365  INFO 13864 --- [r-0-ElectLeader] perationPurgatory$ExpiredOperationReaper : [ExpirationReaper-0-ElectLeader]: Starting
462021-12-09 16:15:01.374  INFO 13864 --- [rFailureHandler] k.s.ReplicaManager$LogDirFailureHandler  : [LogDirFailureHandler]: Starting
472021-12-09 16:15:01.390  INFO 13864 --- [           main] kafka.zk.KafkaZkClient                   : Creating /brokers/ids/0 (is it secure? false)
482021-12-09 16:15:01.400  INFO 13864 --- [           main] kafka.zk.KafkaZkClient                   : Stat of the created znode at /brokers/ids/0 is: 25,25,1639062901396,1639062901396,1,0,0,72059919267528704,204,0,25
49
502021-12-09 16:15:01.400  INFO 13864 --- [           main] kafka.zk.KafkaZkClient                   : Registered broker 0 at path /brokers/ids/0 with addresses: PLAINTEXT://localhost:63919, czxid (broker epoch): 25
512021-12-09 16:15:01.410 ERROR 13864 --- [           main] kafka.server.BrokerMetadataCheckpoint    : Failed to write meta.properties due to
52
53java.nio.file.AccessDeniedException: C:\Users\ddrop\AppData\Local\Temp\spring.kafka.bf8e2b62-a1f2-4092-b292-a15e35bd31ad18378079390566696446
54    at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89) ~[na:na]
55    at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) ~[na:na]
56    at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108) ~[na:na]
57
1...
2  .   ____          _            __ _ _
3 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
4( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
5 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
6  '  |____| .__|_| |_|_| |_\__, | / / / /
7 =========|_|==============|___/=/_/_/_/
8 :: Spring Boot ::                (v2.6.1)
9
102021-12-09 16:15:00.300  INFO 13864 --- [           main] k.utils.Log4jControllerRegistration$     : Registered kafka:type=kafka.Log4jController MBean
112021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     : 
122021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     :   ______                  _                                          
132021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     :  |___  /                 | |                                         
142021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     :     / /    ___     ___   | | __   ___    ___   _ __     ___   _ __   
152021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     :    / /    / _ \   / _ \  | |/ /  / _ \  / _ \ | '_ \   / _ \ | '__|
162021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     :   / /__  | (_) | | (_) | |   <  |  __/ |  __/ | |_) | |  __/ | |    
172021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     :  /_____|  \___/   \___/  |_|\_\  \___|  \___| | .__/   \___| |_|
182021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     :                                               | |                     
192021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     :                                               |_|                     
202021-12-09 16:15:00.420  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     : 
212021-12-09 16:15:00.422  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     : Server environment:zookeeper.version=3.6.3--6401e4ad2087061bc6b9f80dec2d69f2e3c8660a, built on 04/08/2021 16:35 GMT
222021-12-09 16:15:00.422  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     : Server environment:host.name=host.docker.internal
232021-12-09 16:15:00.422  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     : Server environment:java.version=11.0.11
242021-12-09 16:15:00.422  INFO 13864 --- [           main] o.a.zookeeper.server.ZooKeeperServer     : Server environment:java.vendor=AdoptOpenJDK
25...
262021-12-09 16:15:01.015  INFO 13864 --- [nelReaper-Fetch] lientQuotaManager$ThrottledChannelReaper : [ThrottledChannelReaper-Fetch]: Starting
272021-12-09 16:15:01.015  INFO 13864 --- [lReaper-Produce] lientQuotaManager$ThrottledChannelReaper : [ThrottledChannelReaper-Produce]: Starting
282021-12-09 16:15:01.016  INFO 13864 --- [lReaper-Request] lientQuotaManager$ThrottledChannelReaper : [ThrottledChannelReaper-Request]: Starting
292021-12-09 16:15:01.017  INFO 13864 --- [trollerMutation] lientQuotaManager$ThrottledChannelReaper : [ThrottledChannelReaper-ControllerMutation]: Starting
302021-12-09 16:15:01.037  INFO 13864 --- [           main] kafka.log.LogManager                     : Loading logs from log dirs ArraySeq(C:\Users\ddrop\AppData\Local\Temp\spring.kafka.bf8e2b62-a1f2-4092-b292-a15e35bd31ad18378079390566696446)
312021-12-09 16:15:01.040  INFO 13864 --- [           main] kafka.log.LogManager                     : Attempting recovery for all logs in C:\Users\ddrop\AppData\Local\Temp\spring.kafka.bf8e2b62-a1f2-4092-b292-a15e35bd31ad18378079390566696446 since no clean shutdown file was found
322021-12-09 16:15:01.043  INFO 13864 --- [           main] kafka.log.LogManager                     : Loaded 0 logs in 6ms.
332021-12-09 16:15:01.043  INFO 13864 --- [           main] kafka.log.LogManager                     : Starting log cleanup with a period of 300000 ms.
342021-12-09 16:15:01.045  INFO 13864 --- [           main] kafka.log.LogManager                     : Starting log flusher with a default period of 9223372036854775807 ms.
352021-12-09 16:15:01.052  INFO 13864 --- [           main] kafka.log.LogCleaner                     : Starting the log cleaner
362021-12-09 16:15:01.059  INFO 13864 --- [leaner-thread-0] kafka.log.LogCleaner                     : [kafka-log-cleaner-thread-0]: Starting
372021-12-09 16:15:01.224  INFO 13864 --- [name=forwarding] k.s.BrokerToControllerRequestThread      : [BrokerToControllerChannelManager broker=0 name=forwarding]: Starting
382021-12-09 16:15:01.325  INFO 13864 --- [           main] kafka.network.ConnectionQuotas           : Updated connection-accept-rate max connection creation rate to 2147483647
392021-12-09 16:15:01.327  INFO 13864 --- [           main] kafka.network.Acceptor                   : Awaiting socket connections on localhost:63919.
402021-12-09 16:15:01.345  INFO 13864 --- [           main] kafka.network.SocketServer               : [SocketServer listenerType=ZK_BROKER, nodeId=0] Created data-plane acceptor and processors for endpoint : ListenerName(PLAINTEXT)
412021-12-09 16:15:01.350  INFO 13864 --- [0 name=alterIsr] k.s.BrokerToControllerRequestThread      : [BrokerToControllerChannelManager broker=0 name=alterIsr]: Starting
422021-12-09 16:15:01.364  INFO 13864 --- [eaper-0-Produce] perationPurgatory$ExpiredOperationReaper : [ExpirationReaper-0-Produce]: Starting
432021-12-09 16:15:01.364  INFO 13864 --- [nReaper-0-Fetch] perationPurgatory$ExpiredOperationReaper : [ExpirationReaper-0-Fetch]: Starting
442021-12-09 16:15:01.365  INFO 13864 --- [0-DeleteRecords] perationPurgatory$ExpiredOperationReaper : [ExpirationReaper-0-DeleteRecords]: Starting
452021-12-09 16:15:01.365  INFO 13864 --- [r-0-ElectLeader] perationPurgatory$ExpiredOperationReaper : [ExpirationReaper-0-ElectLeader]: Starting
462021-12-09 16:15:01.374  INFO 13864 --- [rFailureHandler] k.s.ReplicaManager$LogDirFailureHandler  : [LogDirFailureHandler]: Starting
472021-12-09 16:15:01.390  INFO 13864 --- [           main] kafka.zk.KafkaZkClient                   : Creating /brokers/ids/0 (is it secure? false)
482021-12-09 16:15:01.400  INFO 13864 --- [           main] kafka.zk.KafkaZkClient                   : Stat of the created znode at /brokers/ids/0 is: 25,25,1639062901396,1639062901396,1,0,0,72059919267528704,204,0,25
49
502021-12-09 16:15:01.400  INFO 13864 --- [           main] kafka.zk.KafkaZkClient                   : Registered broker 0 at path /brokers/ids/0 with addresses: PLAINTEXT://localhost:63919, czxid (broker epoch): 25
512021-12-09 16:15:01.410 ERROR 13864 --- [           main] kafka.server.BrokerMetadataCheckpoint    : Failed to write meta.properties due to
52
53java.nio.file.AccessDeniedException: C:\Users\ddrop\AppData\Local\Temp\spring.kafka.bf8e2b62-a1f2-4092-b292-a15e35bd31ad18378079390566696446
54    at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89) ~[na:na]
55    at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103) ~[na:na]
56    at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108) ~[na:na]
57package com.example.demo;
58
59import org.junit.jupiter.api.Test;
60import org.springframework.boot.test.context.SpringBootTest;
61import org.springframework.kafka.test.context.EmbeddedKafka;
62
63@SpringBootTest
64@EmbeddedKafka
65class ApplicationTest {
66
67    @Test
68    void run() {
69        int i = 1 + 1; // just a line of code to set a debug-point
70    }
71}
72

I do not have this error when pinning kafka.version to 2.8.1 in pom.xml's properties.

It seems like the cause is in Kafka itself, but I have a hard time figuring out if it is spring-kafka intitializing Kafka via EmbeddedKafka incorrectly or if Kafka itself is the culrit here.

Anyone has an idea? Am I missing a test-parameter to set?

ANSWER

Answered 2021-Dec-09 at 15:51

Known bug on the Apache Kafka side. Nothing to do from Spring perspective. See more info here: https://github.com/spring-projects/spring-kafka/discussions/2027. And here: https://issues.apache.org/jira/browse/KAFKA-13391

You need to wait until Apache Kafka 3.0.1 or don't use embedded Kafka and just rely on the Testcontainers, for example, or fully external Apache Kafka broker.

Source https://stackoverflow.com/questions/70292425

QUESTION

Log4j vulnerability - Is Log4j 1.2.17 vulnerable (was unable to find any JNDI code in source)?

Asked 2022-Feb-01 at 15:47

With regard to the Log4j JNDI remote code execution vulnerability that has been identified CVE-2021-44228 - (also see references) - I wondered if Log4j-v1.2 is also impacted, but the closest I got from source code review is the JMS-Appender.

The question is, while the posts on the Internet indicate that Log4j 1.2 is also vulnerable, I am not able to find the relevant source code for it.

Am I missing something that others have identified?

Log4j 1.2 appears to have a vulnerability in the socket-server class, but my understanding is that it needs to be enabled in the first place for it to be applicable and hence is not a passive threat unlike the JNDI-lookup vulnerability which the one identified appears to be.

Is my understanding - that Log4j v1.2 - is not vulnerable to the jndi-remote-code execution bug correct?

References

This blog post from Cloudflare also indicates the same point as from AKX....that it was introduced from Log4j 2!

Update #1 - A fork of the (now-retired) apache-log4j-1.2.x with patch fixes for few vulnerabilities identified in the older library is now available (from the original log4j author). The site is https://reload4j.qos.ch/. As of 21-Jan-2022 version 1.2.18.2 has been released. Vulnerabilities addressed to date include those pertaining to JMSAppender, SocketServer and Chainsaw vulnerabilities. Note that I am simply relaying this information. Have not verified the fixes from my end. Please refer the link for additional details.

ANSWER

Answered 2022-Jan-01 at 18:43

The JNDI feature was added into Log4j 2.0-beta9.

Log4j 1.x thus does not have the vulnerable code.

Source https://stackoverflow.com/questions/70310980

QUESTION

My project doesn't compile with optimization parameters after upgrading from angular 11 to angular 12

Asked 2022-Jan-31 at 19:50

I just upgraded an environment with nrwl from angular version 11 to 12 with two angular applications and several libraries. After update when I try to compile using optimization settings:

angular.json

1{
2 ....
3 "optimization": {
4    "scripts": true,
5    "styles": {
6       "minify": true,
7       "inlineCritical": false
8     },
9     "fonts": true
10  },
11}
12

It gives me the following error (sass and scss component files):

1{
2 ....
3 "optimization": {
4    "scripts": true,
5    "styles": {
6       "minify": true,
7       "inlineCritical": false
8     },
9     "fonts": true
10  },
11}
12/home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/libs/ui-share-components/src/lib/top-panel/top-panel/top-panel.component.sass - Error: /home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/libs/ui-share-components/src/lib/top-panel/top-panel/top-panel.component.sass from Css Minimizer
13Error: Transform failed with 1 error:
14error: Invalid version: "15.2-15.3"
15    at failureErrorWithLog (/home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:1493:15)
16    at /home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:1282:29
17    at /home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:629:9
18    at handleIncomingPacket (/home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:726:9)
19    at Socket.readFromStdout (/home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:596:7)
20    at Socket.emit (events.js:315:20)
21    at addChunk (_stream_readable.js:309:12)
22    at readableAddChunk (_stream_readable.js:284:9)
23    at Socket.Readable.push (_stream_readable.js:223:10)
24    at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)
25

Disabling styles.minify and fonts compiles without problems:

1{
2 ....
3 "optimization": {
4    "scripts": true,
5    "styles": {
6       "minify": true,
7       "inlineCritical": false
8     },
9     "fonts": true
10  },
11}
12/home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/libs/ui-share-components/src/lib/top-panel/top-panel/top-panel.component.sass - Error: /home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/libs/ui-share-components/src/lib/top-panel/top-panel/top-panel.component.sass from Css Minimizer
13Error: Transform failed with 1 error:
14error: Invalid version: "15.2-15.3"
15    at failureErrorWithLog (/home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:1493:15)
16    at /home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:1282:29
17    at /home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:629:9
18    at handleIncomingPacket (/home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:726:9)
19    at Socket.readFromStdout (/home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:596:7)
20    at Socket.emit (events.js:315:20)
21    at addChunk (_stream_readable.js:309:12)
22    at readableAddChunk (_stream_readable.js:284:9)
23    at Socket.Readable.push (_stream_readable.js:223:10)
24    at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)
25"optimization": {
26    "scripts": true,
27    "styles": {
28       "minify": false,
29       "inlineCritical": false
30     },
31     "fonts": false
32  },
33}
34

ANSWER

Answered 2022-Jan-31 at 19:50

Reason of the issue

It is expected browserslist to return an entry for each version ("safari 15.2", "safari 15.3") instead of a range ("safari 15.2-15.3"). So, this is just a bug in the parsing logic of Safari browser versions which needs to be corrected and will be done soon in fixed versions of Angular 12/Angular 13. Link to details is here.

IMPORTANT UPDATE:

This is fixed in v12.2.16 and v13.2.1, please update if you are experiencing this issue. Users on v11 shouldn't be affected. Link to details is here. If you can not/do not want to update for any reason, then one of the workarounds below can be used.

Workarounds:

Modify .browserslistrc

Add to .browserslistrc such lines:

1{
2 ....
3 "optimization": {
4    "scripts": true,
5    "styles": {
6       "minify": true,
7       "inlineCritical": false
8     },
9     "fonts": true
10  },
11}
12/home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/libs/ui-share-components/src/lib/top-panel/top-panel/top-panel.component.sass - Error: /home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/libs/ui-share-components/src/lib/top-panel/top-panel/top-panel.component.sass from Css Minimizer
13Error: Transform failed with 1 error:
14error: Invalid version: "15.2-15.3"
15    at failureErrorWithLog (/home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:1493:15)
16    at /home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:1282:29
17    at /home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:629:9
18    at handleIncomingPacket (/home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:726:9)
19    at Socket.readFromStdout (/home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:596:7)
20    at Socket.emit (events.js:315:20)
21    at addChunk (_stream_readable.js:309:12)
22    at readableAddChunk (_stream_readable.js:284:9)
23    at Socket.Readable.push (_stream_readable.js:223:10)
24    at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)
25"optimization": {
26    "scripts": true,
27    "styles": {
28       "minify": false,
29       "inlineCritical": false
30     },
31     "fonts": false
32  },
33}
34not ios_saf 15.2-15.3 # temporary solution to avoid build issues https://github.com/nrwl/nx/issues/8768
35not safari 15.2-15.3  # temporary solution to avoid build issues https://github.com/nrwl/nx/issues/8768
36

It has to come AFTER any mentions of ios_saf or safari. Otherwise, it doesn't work. Link to workaround is here.

Erase content of .browserslistrc

Erasing content of .browserslistrc helps to fix builds. Link to workaround is here.

Delete .browserslistrc

Deletion of .browserslistrc helps to fix builds. Link to workaround is here.

Install caniuse-lite

Add caniuse-lite package:

1{
2 ....
3 "optimization": {
4    "scripts": true,
5    "styles": {
6       "minify": true,
7       "inlineCritical": false
8     },
9     "fonts": true
10  },
11}
12/home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/libs/ui-share-components/src/lib/top-panel/top-panel/top-panel.component.sass - Error: /home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/libs/ui-share-components/src/lib/top-panel/top-panel/top-panel.component.sass from Css Minimizer
13Error: Transform failed with 1 error:
14error: Invalid version: "15.2-15.3"
15    at failureErrorWithLog (/home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:1493:15)
16    at /home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:1282:29
17    at /home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:629:9
18    at handleIncomingPacket (/home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:726:9)
19    at Socket.readFromStdout (/home/jose/WORK/Rental/REAL/APPS/angular-nx-ws/node_modules/@angular-devkit/build-angular/node_modules/esbuild/lib/main.js:596:7)
20    at Socket.emit (events.js:315:20)
21    at addChunk (_stream_readable.js:309:12)
22    at readableAddChunk (_stream_readable.js:284:9)
23    at Socket.Readable.push (_stream_readable.js:223:10)
24    at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)
25"optimization": {
26    "scripts": true,
27    "styles": {
28       "minify": false,
29       "inlineCritical": false
30     },
31     "fonts": false
32  },
33}
34not ios_saf 15.2-15.3 # temporary solution to avoid build issues https://github.com/nrwl/nx/issues/8768
35not safari 15.2-15.3  # temporary solution to avoid build issues https://github.com/nrwl/nx/issues/8768
36npm install caniuse-lite@1.0.30001303 --save-dev --save-exact
37

Link to workaround is here.

Source https://stackoverflow.com/questions/70910612

QUESTION

How to give certificate to Java Websocket?

Asked 2022-Jan-20 at 10:33

Forgive me for the newb question, but I am confused and obviously not understanding the fundamentals or explanations of how to use a Websocket server hosted over HTTPS. Everything I find online leads me to have more questions than answers.

I have a Websocket server hosted on my HTTPS website using Java code.

This is my WebsocketServer.java file:

1import org.java_websocket.WebSocket;
2import org.java_websocket.handshake.ClientHandshake;
3import org.java_websocket.server.WebSocketServer;
4
5import java.net.InetSocketAddress;
6import java.util.HashSet;
7import java.util.Set;
8
9import org.apache.logging.log4j.LogManager;
10import org.apache.logging.log4j.Logger;
11
12public class WebsocketServer extends WebSocketServer {
13
14    private static final Logger logger = LogManager.getLogger(WebsocketServer.class);
15
16    private static int TCP_PORT = 6868;
17
18    private static Set<WebSocket> conns;
19
20    public WebsocketServer() {
21        super(new InetSocketAddress(TCP_PORT));
22        conns = new HashSet<>();
23    }
24
25    @Override
26    public void onOpen(WebSocket conn, ClientHandshake handshake) {
27        conns.add(conn);
28        logger.info("New connection from " + conn.getRemoteSocketAddress().getAddress().getHostAddress());
29        logger.info("Size of connection list: " + conns.size());
30    }
31
32    @Override
33    public void onClose(WebSocket conn, int code, String reason, boolean remote) {
34        conns.remove(conn);
35        logger.info("Closed connection to " + conn.getRemoteSocketAddress().getAddress().getHostAddress());
36    }
37
38    @Override
39    public void onMessage(WebSocket conn, String message) {
40        logger.info("Message from client: {}", message);
41        // for (WebSocket sock : conns) {
42        // sock.send("SENDING BACK" + message);
43        // }
44    }
45
46    @Override
47    public void onError(WebSocket conn, Exception ex) {
48
49        // ex.printStackTrace();
50        try {
51            if (conn != null) {
52                conns.remove(conn);
53                // do some thing if required
54            }
55            logger.info("ERROR from {}", conn.getRemoteSocketAddress().getAddress().getHostAddress());
56        } catch (Exception e) {
57            logger.info("onError: WebSocketServer may already be running");
58
59        }
60
61    }
62
63    public Set<WebSocket> getConns() {
64        return conns;
65    }
66
67}
68
69

Then I started the WebsocketServer like this:

1import org.java_websocket.WebSocket;
2import org.java_websocket.handshake.ClientHandshake;
3import org.java_websocket.server.WebSocketServer;
4
5import java.net.InetSocketAddress;
6import java.util.HashSet;
7import java.util.Set;
8
9import org.apache.logging.log4j.LogManager;
10import org.apache.logging.log4j.Logger;
11
12public class WebsocketServer extends WebSocketServer {
13
14    private static final Logger logger = LogManager.getLogger(WebsocketServer.class);
15
16    private static int TCP_PORT = 6868;
17
18    private static Set<WebSocket> conns;
19
20    public WebsocketServer() {
21        super(new InetSocketAddress(TCP_PORT));
22        conns = new HashSet<>();
23    }
24
25    @Override
26    public void onOpen(WebSocket conn, ClientHandshake handshake) {
27        conns.add(conn);
28        logger.info("New connection from " + conn.getRemoteSocketAddress().getAddress().getHostAddress());
29        logger.info("Size of connection list: " + conns.size());
30    }
31
32    @Override
33    public void onClose(WebSocket conn, int code, String reason, boolean remote) {
34        conns.remove(conn);
35        logger.info("Closed connection to " + conn.getRemoteSocketAddress().getAddress().getHostAddress());
36    }
37
38    @Override
39    public void onMessage(WebSocket conn, String message) {
40        logger.info("Message from client: {}", message);
41        // for (WebSocket sock : conns) {
42        // sock.send("SENDING BACK" + message);
43        // }
44    }
45
46    @Override
47    public void onError(WebSocket conn, Exception ex) {
48
49        // ex.printStackTrace();
50        try {
51            if (conn != null) {
52                conns.remove(conn);
53                // do some thing if required
54            }
55            logger.info("ERROR from {}", conn.getRemoteSocketAddress().getAddress().getHostAddress());
56        } catch (Exception e) {
57            logger.info("onError: WebSocketServer may already be running");
58
59        }
60
61    }
62
63    public Set<WebSocket> getConns() {
64        return conns;
65    }
66
67}
68
69WebsocketServer websocketServer;
70// Start socket server
71websocketServer = new WebsocketServer();
72websocketServer.start();
73

And on the client side, I connect to it like this:

1import org.java_websocket.WebSocket;
2import org.java_websocket.handshake.ClientHandshake;
3import org.java_websocket.server.WebSocketServer;
4
5import java.net.InetSocketAddress;
6import java.util.HashSet;
7import java.util.Set;
8
9import org.apache.logging.log4j.LogManager;
10import org.apache.logging.log4j.Logger;
11
12public class WebsocketServer extends WebSocketServer {
13
14    private static final Logger logger = LogManager.getLogger(WebsocketServer.class);
15
16    private static int TCP_PORT = 6868;
17
18    private static Set<WebSocket> conns;
19
20    public WebsocketServer() {
21        super(new InetSocketAddress(TCP_PORT));
22        conns = new HashSet<>();
23    }
24
25    @Override
26    public void onOpen(WebSocket conn, ClientHandshake handshake) {
27        conns.add(conn);
28        logger.info("New connection from " + conn.getRemoteSocketAddress().getAddress().getHostAddress());
29        logger.info("Size of connection list: " + conns.size());
30    }
31
32    @Override
33    public void onClose(WebSocket conn, int code, String reason, boolean remote) {
34        conns.remove(conn);
35        logger.info("Closed connection to " + conn.getRemoteSocketAddress().getAddress().getHostAddress());
36    }
37
38    @Override
39    public void onMessage(WebSocket conn, String message) {
40        logger.info("Message from client: {}", message);
41        // for (WebSocket sock : conns) {
42        // sock.send("SENDING BACK" + message);
43        // }
44    }
45
46    @Override
47    public void onError(WebSocket conn, Exception ex) {
48
49        // ex.printStackTrace();
50        try {
51            if (conn != null) {
52                conns.remove(conn);
53                // do some thing if required
54            }
55            logger.info("ERROR from {}", conn.getRemoteSocketAddress().getAddress().getHostAddress());
56        } catch (Exception e) {
57            logger.info("onError: WebSocketServer may already be running");
58
59        }
60
61    }
62
63    public Set<WebSocket> getConns() {
64        return conns;
65    }
66
67}
68
69WebsocketServer websocketServer;
70// Start socket server
71websocketServer = new WebsocketServer();
72websocketServer.start();
73    // APP_WEB_SOCKET is the url to my site: api.my_custom_domain.com
74    var connection = new WebSocket("wss://" + APP_WEB_SOCKET + ":6868");
75

QUESTIONS: I keep reading that I need a certificate if I want to use wss over HTTPS, but cannot find any documents that explain what this means in a way that I can understand.

My app is hosted in AWS Elastic Beanstalk environment. Do I need to somehow add a certificate to the setup of the WebsocketServer in my Java code? Example:

1import org.java_websocket.WebSocket;
2import org.java_websocket.handshake.ClientHandshake;
3import org.java_websocket.server.WebSocketServer;
4
5import java.net.InetSocketAddress;
6import java.util.HashSet;
7import java.util.Set;
8
9import org.apache.logging.log4j.LogManager;
10import org.apache.logging.log4j.Logger;
11
12public class WebsocketServer extends WebSocketServer {
13
14    private static final Logger logger = LogManager.getLogger(WebsocketServer.class);
15
16    private static int TCP_PORT = 6868;
17
18    private static Set<WebSocket> conns;
19
20    public WebsocketServer() {
21        super(new InetSocketAddress(TCP_PORT));
22        conns = new HashSet<>();
23    }
24
25    @Override
26    public void onOpen(WebSocket conn, ClientHandshake handshake) {
27        conns.add(conn);
28        logger.info("New connection from " + conn.getRemoteSocketAddress().getAddress().getHostAddress());
29        logger.info("Size of connection list: " + conns.size());
30    }
31
32    @Override
33    public void onClose(WebSocket conn, int code, String reason, boolean remote) {
34        conns.remove(conn);
35        logger.info("Closed connection to " + conn.getRemoteSocketAddress().getAddress().getHostAddress());
36    }
37
38    @Override
39    public void onMessage(WebSocket conn, String message) {
40        logger.info("Message from client: {}", message);
41        // for (WebSocket sock : conns) {
42        // sock.send("SENDING BACK" + message);
43        // }
44    }
45
46    @Override
47    public void onError(WebSocket conn, Exception ex) {
48
49        // ex.printStackTrace();
50        try {
51            if (conn != null) {
52                conns.remove(conn);
53                // do some thing if required
54            }
55            logger.info("ERROR from {}", conn.getRemoteSocketAddress().getAddress().getHostAddress());
56        } catch (Exception e) {
57            logger.info("onError: WebSocketServer may already be running");
58
59        }
60
61    }
62
63    public Set<WebSocket> getConns() {
64        return conns;
65    }
66
67}
68
69WebsocketServer websocketServer;
70// Start socket server
71websocketServer = new WebsocketServer();
72websocketServer.start();
73    // APP_WEB_SOCKET is the url to my site: api.my_custom_domain.com
74    var connection = new WebSocket("wss://" + APP_WEB_SOCKET + ":6868");
75WebsocketServer websocketServer;
76// Start socket server
77websocketServer = new WebsocketServer();
78
79// example guessing
80websocketServer.cert = "SOMETHING";??
81websocketServer.start();
82

Does the client code need to be changed at all?

Who needs the certificate?

If someone could please explain what I am missing or point me in the correct direction, I would really appreciate it.

ANSWER

Answered 2022-Jan-13 at 14:50

Keep it easy.
Certs inside your application are complex - they are hard to manage and you will get problems to run your application in a modern cloud environment (start new environments, renew certs, scale your application, ...).

Simple conclusion: Dont implement any certs.

How-to get encrypted connections?

As Mike already pointed out in the comments: WebSockets are just upgraded HTTP(S) connections. A normal webserver (nginx, apache) takes care about the certs. It can be done in kubernetes (as ingress-controller) or with a "bare-metal" webserver.
Both of them should act as a reverse-proxy. This means: Your java-application doesn't know anything about certs. It has just unencrypted connections - like in your code on port 6868.
But the client will not use this port. 6868 is only internally reachable.

The client will call your reverse-proxy at the normal HTTPS port (=443). The reverse-proxy will forward the connection to your java-application.

Here some links for further information:

Source https://stackoverflow.com/questions/70654559

QUESTION

Docker error: standard_init_linux.go:228: exec user process caused: exec format error

Asked 2022-Jan-06 at 22:23

I was able to build a multiarch image successfully from an M1 Macbook which is arm64. Here's my docker file and trying to run from a raspberrypi aarch64/arm64 and I am getting this error when running the image: standard_init_linux.go:228: exec user process caused: exec format error

Editing the post with the python file as well:

1FROM frolvlad/alpine-python3
2
3RUN pip3 install docker
4RUN mkdir /hoster
5WORKDIR /hoster
6ADD hoster.py /hoster/
7
8CMD ["python3", "-u", "hoster.py"]
9
10
11
12
13#!/usr/bin/python3
14import docker
15import argparse
16import shutil
17import signal
18import time
19import sys
20import os
21
22label_name = "hoster.domains"
23enclosing_pattern = "#-----------Docker-Hoster-Domains----------\n"
24hosts_path = "/tmp/hosts"
25hosts = {}
26
27def signal_handler(signal, frame):
28    global hosts
29    hosts = {}
30    update_hosts_file()
31    sys.exit(0)
32
33def main():
34    # register the exit signals
35    signal.signal(signal.SIGINT, signal_handler)
36    signal.signal(signal.SIGTERM, signal_handler)
37
38    args = parse_args()
39    global hosts_path
40    hosts_path = args.file
41
42    dockerClient = docker.APIClient(base_url='unix://%s' % args.socket)
43    events = dockerClient.events(decode=True)
44    #get running containers
45    for c in dockerClient.containers(quiet=True, all=False):
46        container_id = c["Id"]
47        container = get_container_data(dockerClient, container_id)
48        hosts[container_id] = container
49
50    update_hosts_file()
51
52    #listen for events to keep the hosts file updated
53    for e in events:
54        if e["Type"]!="container": 
55            continue
56        
57        status = e["status"]
58        if status =="start":
59            container_id = e["id"]
60            container = get_container_data(dockerClient, container_id)
61            hosts[container_id] = container
62            update_hosts_file()
63
64        if status=="stop" or status=="die" or status=="destroy":
65            container_id = e["id"]
66            if container_id in hosts:
67                hosts.pop(container_id)
68                update_hosts_file()
69
70
71def get_container_data(dockerClient, container_id):
72    #extract all the info with the docker api
73    info = dockerClient.inspect_container(container_id)
74    container_hostname = info["Config"]["Hostname"]
75    container_name = info["Name"].strip("/")
76    container_ip = info["NetworkSettings"]["IPAddress"]
77    if info["Config"]["Domainname"]:
78        container_hostname = container_hostname + "." + info["Config"]["Domainname"]
79    
80    result = []
81
82    for values in info["NetworkSettings"]["Networks"].values():
83        
84        if not values["Aliases"]: 
85            continue
86
87        result.append({
88                "ip": values["IPAddress"] , 
89                "name": container_name,
90                "domains": set(values["Aliases"] + [container_name, container_hostname])
91            })
92
93    if container_ip:
94        result.append({"ip": container_ip, "name": container_name, "domains": [container_name, container_hostname ]})
95
96    return result
97
98
99def update_hosts_file():
100    if len(hosts)==0:
101        print("Removing all hosts before exit...")
102    else:
103        print("Updating hosts file with:")
104
105    for id,addresses in hosts.items():
106        for addr in addresses:
107            print("ip: %s domains: %s" % (addr["ip"], addr["domains"]))
108
109    #read all the lines of thge original file
110    lines = []
111    with open(hosts_path,"r+") as hosts_file:
112        lines = hosts_file.readlines()
113
114    #remove all the lines after the known pattern
115    for i,line in enumerate(lines):
116        if line==enclosing_pattern:
117            lines = lines[:i]
118            break;
119
120    #remove all the trailing newlines on the line list
121    if lines:
122        while lines[-1].strip()=="": lines.pop()
123
124    #append all the domain lines
125    if len(hosts)>0:
126        lines.append("\n\n"+enclosing_pattern)
127        
128        for id, addresses in hosts.items():
129            for addr in addresses:
130                lines.append("%s    %s\n"%(addr["ip"],"   ".join(addr["domains"])))
131        
132        lines.append("#-----Do-not-add-hosts-after-this-line-----\n\n")
133
134    #write it on the auxiliar file
135    aux_file_path = hosts_path+".aux"
136    with open(aux_file_path,"w") as aux_hosts:
137        aux_hosts.writelines(lines)
138
139    #replace etc/hosts with aux file, making it atomic
140    shutil.move(aux_file_path, hosts_path)
141
142
143def parse_args():
144    parser = argparse.ArgumentParser(description='Synchronize running docker container IPs with host /etc/hosts file.')
145    parser.add_argument('socket', type=str, nargs="?", default="tmp/docker.sock", help='The docker socket to listen for docker events.')
146    parser.add_argument('file', type=str, nargs="?", default="/tmp/hosts", help='The /etc/hosts file to sync the containers with.')
147    return parser.parse_args()
148
149if __name__ == '__main__':
150    main()
151

ANSWER

Answered 2021-Oct-27 at 16:58

A "multiarch" Python interpreter built on MacOS is intended to target MacOS-on-Intel and MacOS-on-Apple's-arm64.

There is absolutely no binary compatibility with Linux-on-Apple's-arm64, or with Linux-on-aarch64. You can't run MacOS executables on Linux, no matter if the architecture matches or not.

Source https://stackoverflow.com/questions/69739201

QUESTION

Wrong PHP version used when installing composer with Alpine's apk command

Asked 2021-Dec-23 at 11:20

I've got a docker image running 8.0 and want to upgrade to 8.1. I have updated the image to run with PHP 8.1 and want to update the dependencies in it.

The new image derives from php:8.1.1-fpm-alpine3.15

I've updated the composer.json and changed require.php to ^8.1 but ran into the following message when running composer upgrade:

1Root composer.json requires php ^8.1 but your php version (8.0.14) does not satisfy that requirement.
2

What I find dazzling is that the composer incorrectly identifies PHP version. I used two commands to determine that:

1Root composer.json requires php ^8.1 but your php version (8.0.14) does not satisfy that requirement.
2which php # returns only /usr/local/bin/php
3/usr/local/bin/php -v # returns PHP 8.1.1 (cli) (built: Dec 18 2021 01:38:53) (NTS)
4

So far I've tried:

  • Checking php -v
  • Clearing composer cache
  • Rebuilding image

Composer version 2.1.12 2021-11-09 16:02:04

1Root composer.json requires php ^8.1 but your php version (8.0.14) does not satisfy that requirement.
2which php # returns only /usr/local/bin/php
3/usr/local/bin/php -v # returns PHP 8.1.1 (cli) (built: Dec 18 2021 01:38:53) (NTS)
4composer check-platform-reqs | grep php
5# returns:
6# ...
7# php                   8.0.14  project/name requires php (^8.1)                   failed  
8

All of the commands above (excluding docker commands) are being ran in the container

Dockerfile:

1Root composer.json requires php ^8.1 but your php version (8.0.14) does not satisfy that requirement.
2which php # returns only /usr/local/bin/php
3/usr/local/bin/php -v # returns PHP 8.1.1 (cli) (built: Dec 18 2021 01:38:53) (NTS)
4composer check-platform-reqs | grep php
5# returns:
6# ...
7# php                   8.0.14  project/name requires php (^8.1)                   failed  
8FROM php:8.1.1-fpm-alpine3.15
9
10ENV TZ=Europe/London
11
12# Install php lib deps
13RUN apk update && apk upgrade
14RUN apk add --update libzip-dev \
15        zip \
16        unzip \
17        libpng-dev \
18        nginx \
19        supervisor \
20        git \
21        curl \
22        shadow \
23        composer \
24        yarn && rm -rf /var/cache/apk/*
25
26RUN usermod -u 1000 www-data
27RUN usermod -d /var/www www-data
28
29RUN mkdir -p /run/nginx && chown www-data:www-data /run/nginx
30
31ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.1.9/supercronic-linux-amd64 \
32    SUPERCRONIC=supercronic-linux-amd64 \
33    SUPERCRONIC_SHA1SUM=5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85
34
35RUN curl -fsSLO "$SUPERCRONIC_URL" \
36 && echo "${SUPERCRONIC_SHA1SUM}  ${SUPERCRONIC}" | sha1sum -c - \
37 && chmod +x "$SUPERCRONIC" \
38 && mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \
39 && ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic
40
41# Install and enable php extensions
42RUN docker-php-ext-install sockets mysqli pdo_mysql zip gd bcmath > /dev/null
43
44ARG ENV="development"
45# Xdebug install
46RUN if [ $ENV = "development" ] ; then \
47        apk add --no-cache $PHPIZE_DEPS; \
48        pecl install xdebug > /dev/null; \
49        docker-php-ext-enable xdebug; \
50        echo "error_reporting = E_ALL" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \
51        echo "display_startup_errors = On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \
52        echo "display_errors = On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \
53        echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \
54    fi ;
55
56# Setup working directory
57RUN chown -R www-data:www-data /var/www
58WORKDIR /var/www
59USER www-data
60
61
62# Install dependencies
63#RUN if [ $ENV = "development" ] ; then \
64##        composer install -n; \
65#    else \
66##        composer install -n --no-dev; \
67#    fi ;
68
69# Generate doctrine proxies
70

ANSWER

Answered 2021-Dec-23 at 11:20

Huh. This surprised me a bit.

composer is correctly reporting the PHP version it's using. The problem is that it's not using the "correct" PHP interpreter.

The issue arises because of how you are installing composer.

Apparently by doing apk add composer another version of PHP gets installed (you can find it on /usr/bin/php8, this is the one on version 8.0.14).

Instead of letting apk install composer for you, you can do it manually. There is nothing much to install it in any case, no need to go through the package manager. Particularly since PHP has not been installed via the package manager on your base image.

I've just removed the line containing composer from the apk add --update command, and added this somewhere below:

1Root composer.json requires php ^8.1 but your php version (8.0.14) does not satisfy that requirement.
2which php # returns only /usr/local/bin/php
3/usr/local/bin/php -v # returns PHP 8.1.1 (cli) (built: Dec 18 2021 01:38:53) (NTS)
4composer check-platform-reqs | grep php
5# returns:
6# ...
7# php                   8.0.14  project/name requires php (^8.1)                   failed  
8FROM php:8.1.1-fpm-alpine3.15
9
10ENV TZ=Europe/London
11
12# Install php lib deps
13RUN apk update && apk upgrade
14RUN apk add --update libzip-dev \
15        zip \
16        unzip \
17        libpng-dev \
18        nginx \
19        supervisor \
20        git \
21        curl \
22        shadow \
23        composer \
24        yarn && rm -rf /var/cache/apk/*
25
26RUN usermod -u 1000 www-data
27RUN usermod -d /var/www www-data
28
29RUN mkdir -p /run/nginx && chown www-data:www-data /run/nginx
30
31ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.1.9/supercronic-linux-amd64 \
32    SUPERCRONIC=supercronic-linux-amd64 \
33    SUPERCRONIC_SHA1SUM=5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85
34
35RUN curl -fsSLO "$SUPERCRONIC_URL" \
36 && echo "${SUPERCRONIC_SHA1SUM}  ${SUPERCRONIC}" | sha1sum -c - \
37 && chmod +x "$SUPERCRONIC" \
38 && mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \
39 && ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic
40
41# Install and enable php extensions
42RUN docker-php-ext-install sockets mysqli pdo_mysql zip gd bcmath > /dev/null
43
44ARG ENV="development"
45# Xdebug install
46RUN if [ $ENV = "development" ] ; then \
47        apk add --no-cache $PHPIZE_DEPS; \
48        pecl install xdebug > /dev/null; \
49        docker-php-ext-enable xdebug; \
50        echo "error_reporting = E_ALL" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \
51        echo "display_startup_errors = On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \
52        echo "display_errors = On" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \
53        echo "xdebug.remote_enable=1" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \
54    fi ;
55
56# Setup working directory
57RUN chown -R www-data:www-data /var/www
58WORKDIR /var/www
59USER www-data
60
61
62# Install dependencies
63#RUN if [ $ENV = "development" ] ; then \
64##        composer install -n; \
65#    else \
66##        composer install -n --no-dev; \
67#    fi ;
68
69# Generate doctrine proxies
70 RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
71     php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
72     php composer-setup.php && \
73     php -r "unlink('composer-setup.php');" && \
74     mv composer.phar /usr/local/bin/composer;
75

You could also simply download the latest composer PHAR file from here, and add it to the image, depending on how you want to go.

Now there is a single PHP version, and composer will run correctly on PHP 8.1.1.

Source https://stackoverflow.com/questions/70439028

QUESTION

Can't listen to event sent from feathers server to client

Asked 2021-Dec-17 at 07:57

I'm building a server which uses feathers and socketio.

I'm trying to use feathers channels mechanism to notify relevant users (connections) on relevant events.
Users belong to groups, so upon connecting to the server, I add the connection to the appropriate channels.
Upon publishing, inside app.publish, I'm getting the right data and see that the connection is attached to the channel, but can't figure out how to listen to it on the client.

This is a simplified channels.js:

1app.on('connection', async (connection) => {
2    connection.userGroups.forEach((group) => {
3        app.channel(`group.groupId`).join(connection);
4    }
5    app.channel('1').join(connection); // dummy channel
6}
7
8app.publish((data, context) => {
9    console.log(app.channel('1')); // output shown below
10   
11    return app.channel('1');
12});
13

I'm using Postman as the client, sending a patch request, and listening to event named rooms patched (rooms is my service name) as described in feathers docs. No event is arriving.
If I'm using the raw socketio instance and emitting from there, everything seems to work fine and I get the event in the client

1app.on('connection', async (connection) => {
2    connection.userGroups.forEach((group) => {
3        app.channel(`group.groupId`).join(connection);
4    }
5    app.channel('1').join(connection); // dummy channel
6}
7
8app.publish((data, context) => {
9    console.log(app.channel('1')); // output shown below
10   
11    return app.channel('1');
12});
13app.io.sockets.in('some room').emit('rooms patched', data);
14

but as I understand it, it overrides the whole mechanism of channels.

By examining the output from app.publish

1app.on('connection', async (connection) => {
2    connection.userGroups.forEach((group) => {
3        app.channel(`group.groupId`).join(connection);
4    }
5    app.channel('1').join(connection); // dummy channel
6}
7
8app.publish((data, context) => {
9    console.log(app.channel('1')); // output shown below
10   
11    return app.channel('1');
12});
13app.io.sockets.in('some room').emit('rooms patched', data);
14Channel {
15  _events: [Object: null prototype] {
16    empty: [Function: bound onceWrapper] { listener: [Function (anonymous)] }
17  },
18  _eventsCount: 1,
19  _maxListeners: undefined,
20  connections: [
21    {
22      provider: 'socketio',
23      headers: [Object],
24      userInfo: [Object],
25      userGroups: [Array]
26    }
27  ],
28  data: null,
29  [Symbol(kCapture)]: false
30}
31

we can see that the connection is there.

Can anyone help me figure this problem out?

ANSWER

Answered 2021-Dec-16 at 08:17

Does a port need to be opened on the clients end to create the channel so the communication line is 2 ways. Perhaps javascript will have some code to open up the clients port.

Source https://stackoverflow.com/questions/70259246

QUESTION

Cypress Test Runner unexpectedly exited via a exit event with signal SIGSEGV in circleCI

Asked 2021-Dec-10 at 11:43


I am stuck in this problem. I am running cypress tests. When I run locally, it runs smoothly. when I run in circleCI, it throws error after some execution.
Here is what i am getting:

1[334:1020/170552.614728:ERROR:bus.cc(392)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
2[334:1020/170552.616006:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
3[334:1020/170552.616185:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
4[521:1020/170552.652819:ERROR:gpu_init.cc(441)] Passthrough is not supported, GL is swiftshader
5

Current behavior:
When I run my specs headless on the circleCI, Cypress closed unexpectedly with a socket error.

Error code:

The Test Runner unexpectedly exited via a exit event with signal SIGSEGV

Please search Cypress documentation for possible solutions:

https://on.cypress.io


Platform: linux (Debian - 10.5)
Cypress Version: 8.6.0

ANSWER

Answered 2021-Oct-21 at 08:53

Issue resolved by reverting back cypress version to 7.6.0.

Source https://stackoverflow.com/questions/69658152

QUESTION

localhost:5000 unavailable in macOS v12 (Monterey)

Asked 2021-Dec-08 at 14:08

I cannot access a web server on localhost port 5000 on macOS v12 (Monterey) (Flask or any other).

E.g., use the built-in HTTP server, I cannot get onto port 5000:

1python3 -m http.server 5000
2
3... (stack trace)
4File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 466, in server_bind
5self.socket.bind(self.server_address)
6OSError: [Errno 48] Address already in use
7

If you have Flask installed and you run the Flask web server, it does not fail on start. Let's take the minimum Flask example code:

1python3 -m http.server 5000
2
3... (stack trace)
4File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 466, in server_bind
5self.socket.bind(self.server_address)
6OSError: [Errno 48] Address already in use
7# Save as hello.py in the current working directory.
8from flask import Flask
9app = Flask(__name__)
10@app.route("/")
11def hello_world():
12    return "<p>Hello, World!</p>"
13

Then run it (provided you have Flask/Python 3 installed):

1python3 -m http.server 5000
2
3... (stack trace)
4File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 466, in server_bind
5self.socket.bind(self.server_address)
6OSError: [Errno 48] Address already in use
7# Save as hello.py in the current working directory.
8from flask import Flask
9app = Flask(__name__)
10@app.route("/")
11def hello_world():
12    return "<p>Hello, World!</p>"
13export FLASK_APP=hello
14flask run
15

Output:

1python3 -m http.server 5000
2
3... (stack trace)
4File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 466, in server_bind
5self.socket.bind(self.server_address)
6OSError: [Errno 48] Address already in use
7# Save as hello.py in the current working directory.
8from flask import Flask
9app = Flask(__name__)
10@app.route("/")
11def hello_world():
12    return "<p>Hello, World!</p>"
13export FLASK_APP=hello
14flask run
15* Running on http://127.0.0.1:5000/
16

However, if you try to access this server (from a browser or with anything else), it is denied:

1python3 -m http.server 5000
2
3... (stack trace)
4File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 466, in server_bind
5self.socket.bind(self.server_address)
6OSError: [Errno 48] Address already in use
7# Save as hello.py in the current working directory.
8from flask import Flask
9app = Flask(__name__)
10@app.route("/")
11def hello_world():
12    return "<p>Hello, World!</p>"
13export FLASK_APP=hello
14flask run
15* Running on http://127.0.0.1:5000/
16curl -I localhost:5000
17HTTP/1.1 403 Forbidden
18Content-Length: 0
19Server: AirTunes/595.13.1
20

ANSWER

Answered 2021-Dec-08 at 14:08

macOS Monterey introduced AirPlay Receiver running on port 5000. This prevents your web server from serving on port 5000. Receiver already has the port.

You can either:

  1. turn off AirPlay Receiver, or;
  2. run the server on a different port (normally best).

Turn off AirPlay Receiver

Go to System PreferencesSharingUntick Airplay Receiver.

Enter image description here

See more details

You should be able to rerun the server now on port 5000 and get a response:

1python3 -m http.server 5000
2
3... (stack trace)
4File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 466, in server_bind
5self.socket.bind(self.server_address)
6OSError: [Errno 48] Address already in use
7# Save as hello.py in the current working directory.
8from flask import Flask
9app = Flask(__name__)
10@app.route("/")
11def hello_world():
12    return "<p>Hello, World!</p>"
13export FLASK_APP=hello
14flask run
15* Running on http://127.0.0.1:5000/
16curl -I localhost:5000
17HTTP/1.1 403 Forbidden
18Content-Length: 0
19Server: AirTunes/595.13.1
20python3 -m http.server 5000
21
22Serving HTTP on :: port 5000 (http://[::]:5000/) ...
23

Run the server on a different port than 5000

It's probably a better idea to no longer use port 5000 as that's reserved for Airplay Receiver on macOS Monterey.

Just to run the server on a different port. There isn't any need to turn off Airplay Receiver.

1python3 -m http.server 5000
2
3... (stack trace)
4File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 466, in server_bind
5self.socket.bind(self.server_address)
6OSError: [Errno 48] Address already in use
7# Save as hello.py in the current working directory.
8from flask import Flask
9app = Flask(__name__)
10@app.route("/")
11def hello_world():
12    return "<p>Hello, World!</p>"
13export FLASK_APP=hello
14flask run
15* Running on http://127.0.0.1:5000/
16curl -I localhost:5000
17HTTP/1.1 403 Forbidden
18Content-Length: 0
19Server: AirTunes/595.13.1
20python3 -m http.server 5000
21
22Serving HTTP on :: port 5000 (http://[::]:5000/) ...
23python3 -m http.server 4999
24

or

1python3 -m http.server 5000
2
3... (stack trace)
4File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py", line 466, in server_bind
5self.socket.bind(self.server_address)
6OSError: [Errno 48] Address already in use
7# Save as hello.py in the current working directory.
8from flask import Flask
9app = Flask(__name__)
10@app.route("/")
11def hello_world():
12    return "<p>Hello, World!</p>"
13export FLASK_APP=hello
14flask run
15* Running on http://127.0.0.1:5000/
16curl -I localhost:5000
17HTTP/1.1 403 Forbidden
18Content-Length: 0
19Server: AirTunes/595.13.1
20python3 -m http.server 5000
21
22Serving HTTP on :: port 5000 (http://[::]:5000/) ...
23python3 -m http.server 4999
24export FLASK_APP=hello
25flask run -p 4999
26

Source https://stackoverflow.com/questions/69818376

QUESTION

Running Cypress on WSL

Asked 2021-Nov-17 at 22:49

I'm trying to run cypress on a WSL with Ubuntu, this is what I'm getting:

1$ cypress run
2[29023:1018/155130.159647:ERROR:bus.cc(392)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
3[29023:1018/155130.162020:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
4[29023:1018/155130.162068:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
5[29211:1018/155130.193707:ERROR:gpu_init.cc(441)] Passthrough is not supported, GL is swiftshader
6
7...
8
9[29023:1018/155132.292604:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
10
11Timed out waiting for the browser to connect. Retrying...
12[29023:1018/155232.249036:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
13
14Timed out waiting for the browser to connect. Retrying again...
15[29023:1018/155332.249372:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
16 (-2) loading 'http://localhost:3000/__/#/tests/integration/simple.spec.ts'
17Error:  (-2) loading 'http://localhost:3000/__/#/tests/integration/simple.spec.ts'
18    at rejectAndCleanup (electron/js2c/browser_init.js:161:7486)
19    at Object.failListener (electron/js2c/browser_init.js:161:7699)
20    at Object.emit (events.js:376:20)
21
22

I couldn't find any related topics, any help?

ANSWER

Answered 2021-Oct-19 at 14:32

Cypress requires the ability to run its GUI. Depending on your Windows version, you likely need some additional configuration in order to run GUI applications in WSL:

1$ cypress run
2[29023:1018/155130.159647:ERROR:bus.cc(392)] Failed to connect to the bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
3[29023:1018/155130.162020:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
4[29023:1018/155130.162068:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
5[29211:1018/155130.193707:ERROR:gpu_init.cc(441)] Passthrough is not supported, GL is swiftshader
6
7...
8
9[29023:1018/155132.292604:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
10
11Timed out waiting for the browser to connect. Retrying...
12[29023:1018/155232.249036:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
13
14Timed out waiting for the browser to connect. Retrying again...
15[29023:1018/155332.249372:ERROR:bus.cc(392)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
16 (-2) loading 'http://localhost:3000/__/#/tests/integration/simple.spec.ts'
17Error:  (-2) loading 'http://localhost:3000/__/#/tests/integration/simple.spec.ts'
18    at rejectAndCleanup (electron/js2c/browser_init.js:161:7486)
19    at Object.failListener (electron/js2c/browser_init.js:161:7699)
20    at Object.emit (events.js:376:20)
21
22apt-get install libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
23

This may have been done for you depending on how you installed Cypress. I used the npm directions in the Cypress doc.

  • Windows 11 includes the WSLg feature by default, which allows you to run GUI applications directly on Windows. If you upgraded from Windows 10 to Windows 11, run wsl --update to make sure you have the latest WSL version with WSLg.

    Also make sure, if you've attempted to run an X server on an older release (like in the next suggestion), that you remove any manual configuration of DISPLAY in your startup files (e.g. ~/.bashrc, etc.).

  • For Windows 10, you will need to do some additional configuration. There are really two ways to do this, but it's a better topic for Super User (since it isn't directly related to programming), so I'm going to point you to this Super User question for some details. Either answer there is fine. While I'm partial to my solution, most people opt for running a third-party X server as in harrymc's answer there.

  • Just to make sure there weren't any "hidden tricks" needed to get Cypress running, I can confirm that I was able to successfully ./node_modules/.bin/cypress open using the Cypress instructions and my xrdp technique from the Super User answer.

    Source https://stackoverflow.com/questions/69621197

    Community Discussions contain sources that include Stack Exchange Network

    Tutorials and Learning Resources in Socket

    Tutorials and Learning Resources are not available at this moment for Socket

    Share this Page

    share link

    Get latest updates on Socket