Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into warn-connections
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone committed Nov 5, 2024
2 parents b166c84 + a8d7095 commit 2359372
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 89 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ jobs:
# Release builds
- os: macos-15
config: "release"
# https://github.com/zeroc-ice/ice/issues/2061
test_flags: "--rfilter=csharp/Ice/adapterDeactivation"
- os: ubuntu-24.04
config: "release"
- os: windows-2022
Expand All @@ -42,8 +40,7 @@ jobs:
- os: macos-15
config: "debug"
build_flags: "OPTIMIZE=no"
# https://github.com/zeroc-ice/ice/issues/2061
test_flags: "--swift-config=debug --rfilter=csharp/Ice/adapterDeactivation"
test_flags: "--swift-config=debug"
- os: ubuntu-24.04
config: "debug"
build_flags: "OPTIMIZE=no"
Expand Down
6 changes: 6 additions & 0 deletions cpp/src/Ice/WSTransceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ IceInternal::WSTransceiver::initialize(Buffer& readBuffer, Buffer& writeBuffer)
}
assert(_writeBuffer.i == _writeBuffer.b.end());
_state = StateUpgradeResponsePending;

if (_instance->traceLevel() >= 1)
{
Trace out(_instance->logger(), _instance->traceCategory());
out << "sent " << protocol() << " connection HTTP upgrade request\n" << toString();
}
}

while (true)
Expand Down
18 changes: 4 additions & 14 deletions cpp/src/IceBox/Admin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,7 @@
using namespace std;
using namespace IceInternal;

int run(const Ice::StringSeq&);

Ice::CommunicatorPtr communicator;

void
destroyCommunicator(int)
{
communicator->destroy();
}
int run(const Ice::CommunicatorPtr&, const Ice::StringSeq&);

int
#ifdef _WIN32
Expand All @@ -39,11 +31,9 @@ main(int argc, char* argv[])

Ice::CommunicatorHolder ich{argc, argv, initData};

communicator = ich.communicator();

ctrlCHandler.setCallback(&destroyCommunicator);
ctrlCHandler.setCallback([communicator = ich.communicator()](int) { communicator->destroy(); });

status = run(Ice::argsToStringSeq(argc, argv));
status = run(ich.communicator(), Ice::argsToStringSeq(argc, argv));
}
catch (const std::exception& ex)
{
Expand All @@ -69,7 +59,7 @@ usage(const string& name)
}

int
run(const Ice::StringSeq& args)
run(const Ice::CommunicatorPtr& communicator, const Ice::StringSeq& args)
{
IceInternal::Options opts;
opts.addOpt("h", "help");
Expand Down
7 changes: 7 additions & 0 deletions csharp/src/Ice/Internal/WSTransceiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ public int initialize(Buffer readBuffer, Buffer writeBuffer, ref bool hasMoreDat
}
Debug.Assert(!_writeBuffer.b.hasRemaining());
_state = StateUpgradeResponsePending;

if (_instance.traceLevel() >= 1)
{
_instance.logger().trace(
_instance.traceCategory(),
"sent " + protocol() + " connection HTTP upgrade request\n" + ToString());
}
}

while (true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ final class FileLoggerI extends LoggerI {
super(prefix);

if (file.isEmpty()) {
throw new InitializationException("FileLogger: file name is empty");
throw new FileException("FileLogger: file name is empty");
}

try {
_out = new java.io.FileOutputStream(new java.io.File(file), true);
} catch (java.io.FileNotFoundException ex) {
throw new InitializationException("FileLogger: cannot open " + file);
throw new FileException("FileLogger: cannot open '" + file + "': file not found", ex);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ public void initialize(Communicator communicator, InitializationData initData) {
} else {
_cacheMessageBuffers = properties.getIcePropertyAsInt("Ice.CacheMessageBuffers");
}
} catch (LocalException ex) {
} catch (Exception ex) {
destroy(false);
throw ex;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ public int initialize(Buffer readBuffer, Buffer writeBuffer) {
}
assert (!_writeBuffer.b.hasRemaining());
_state = StateUpgradeResponsePending;

if (_instance.traceLevel() >= 1) {
_instance
.logger()
.trace(
_instance.traceCategory(),
"sent "
+ protocol()
+ " connection HTTP upgrade request\n"
+ toString());
}
}

while (true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ public ControllerI(boolean bluetooth)
initData.properties.setProperty("Ice.ThreadPool.Server.SizeMax", "10");
initData.properties.setProperty("ControllerAdapter.Endpoints", "tcp");
initData.properties.setProperty("ControllerAdapter.AdapterId", java.util.UUID.randomUUID().toString());
initData.properties.setProperty("Ice.Override.ConnectTimeout", "1000");
if(!isEmulator())
{
if(bluetooth)
Expand Down
24 changes: 0 additions & 24 deletions java/test/src/main/java/test/Ice/binding/AllTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ public static void allTests(test.TestHelper helper) {
// Usually the actual type of this exception is ConnectionRefusedException,
// but not always. See bug 3179.
//
} catch (com.zeroc.Ice.ConnectTimeoutException ex) {
//
// On Windows, we set Ice.Override.ConnectTimeout to speed up testing.
//
}
}
out.println("ok");
Expand Down Expand Up @@ -409,10 +405,6 @@ public static void allTests(test.TestHelper helper) {
// Usually the actual type of this exception is ConnectionRefusedException,
// but not always. See bug 3179.
//
} catch (com.zeroc.Ice.ConnectTimeoutException ex) {
//
// On Windows, we set Ice.Override.ConnectTimeout to speed up testing.
//
}

Endpoint[] endpoints = test.ice_getEndpoints();
Expand Down Expand Up @@ -467,10 +459,6 @@ public static void allTests(test.TestHelper helper) {
// Usually the actual type of this exception is ConnectionRefusedException,
// but not always. See bug 3179.
//
} catch (com.zeroc.Ice.ConnectTimeoutException ex) {
//
// On Windows, we set Ice.Override.ConnectTimeout to speed up testing.
//
}
}
out.println("ok");
Expand Down Expand Up @@ -585,10 +573,6 @@ public static void allTests(test.TestHelper helper) {
// Usually the actual type of this exception is ConnectionRefusedException,
// but not always. See bug 3179.
//
} catch (com.zeroc.Ice.ConnectTimeoutException ex) {
//
// On Windows, we set Ice.Override.ConnectTimeout to speed up testing.
//
}

Endpoint[] endpoints = test.ice_getEndpoints();
Expand Down Expand Up @@ -656,10 +640,6 @@ public static void allTests(test.TestHelper helper) {
// Usually the actual type of this exception is ConnectionRefusedException,
// but not always. See bug 3179.
//
} catch (com.zeroc.Ice.ConnectTimeoutException ex) {
//
// On Windows, we set Ice.Override.ConnectTimeout to speed up testing.
//
}

Endpoint[] endpoints = test.ice_getEndpoints();
Expand Down Expand Up @@ -753,10 +733,6 @@ public static void allTests(test.TestHelper helper) {
// Usually the actual type of this exception is ConnectionRefusedException,
// but not always. See bug 3179.
//
} catch (com.zeroc.Ice.ConnectTimeoutException ex) {
//
// On Windows, we set Ice.Override.ConnectTimeout to speed up testing.
//
}

deactivate(rcom, adapters);
Expand Down
1 change: 0 additions & 1 deletion js/test/Common/ControllerI.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ export async function runController(clientOutput, serverOutput, scripts) {
const initData = new Ice.InitializationData();
initData.logger = new Logger(out);
initData.properties = Ice.createProperties();
initData.properties.setProperty("Ice.Override.ConnectTimeout", "1000");

async function registerProcessController(adapter, registry, processController) {
try {
Expand Down
20 changes: 6 additions & 14 deletions ruby/test/Ice/exceptions/AllTests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,17 @@ def allTests(helper, communicator)
print "testing value factory registration exception... "
STDOUT.flush
vf = ValueFactoryI.new

vfm = communicator.getValueFactoryManager()
test(vfm.class == Ice::ValueFactoryManager) # created by the C++ code

vfm.add(vf, "x")
communicator.getValueFactoryManager().add(vf, "x")
begin
vfm.add(vf, "x")
communicator.getValueFactoryManager().add(vf, "x")
test(false)
rescue Ice::AlreadyRegisteredException => ex
test(ex.kindOfObject == "value factory")
test(ex.id == "x")
rescue Ice::AlreadyRegisteredException
end
vfm.add(vf, "")
communicator.getValueFactoryManager().add(vf, "")
begin
vfm.add(vf, "")
communicator.getValueFactoryManager().add(vf, "")
test(false)
rescue Ice::AlreadyRegisteredException => ex
test(ex.kindOfObject == "value factory")
test(ex.id == "")
rescue Ice::AlreadyRegisteredException
end
puts "ok"

Expand Down
14 changes: 6 additions & 8 deletions ruby/test/Ice/objects/AllTests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,13 @@ def test(b)
def allTests(helper, communicator)

factory = MyValueFactory.new
valueFactoryManager = communicator.getValueFactoryManager()
test(valueFactoryManager != nil)
valueFactoryManager.add(factory, '::Test::B')
valueFactoryManager.add(factory, '::Test::C')
communicator.getValueFactoryManager().add(factory, '::Test::B')
communicator.getValueFactoryManager().add(factory, '::Test::C')
#communicator.getValueFactoryManager().add(factory, '::Test::D')
valueFactoryManager.add(factory, '::Test::E')
valueFactoryManager.add(factory, '::Test::F')
valueFactoryManager.add(factory, '::Test::I')
valueFactoryManager.add(factory, '::Test::J')
communicator.getValueFactoryManager().add(factory, '::Test::E')
communicator.getValueFactoryManager().add(factory, '::Test::F')
communicator.getValueFactoryManager().add(factory, '::Test::I')
communicator.getValueFactoryManager().add(factory, '::Test::J')

initial = Test::InitialPrx.new(communicator, "initial:#{helper.getTestEndpoint()}")

Expand Down
22 changes: 4 additions & 18 deletions scripts/Util.py
Original file line number Diff line number Diff line change
Expand Up @@ -867,11 +867,12 @@ def getProps(self, process, current):
props["Ice.Override.Compress"] = "1"
if self.serialize:
props["Ice.ThreadPool.Server.Serialize"] = "1"
# JavaScript does not support the Ice.IPv6 property

if not isinstance(current.testsuite.getMapping(), JavaScriptMapping):
# JavaScript does not support the IPv6 properties
props["Ice.IPv6"] = self.ipv6
if self.ipv6:
props["Ice.PreferIPv6Address"] = True
if self.ipv6:
props["Ice.PreferIPv6Address"] = True
if self.mx:
props["Ice.Admin.Endpoints"] = (
'tcp -h "::1"' if self.ipv6 else "tcp -h 127.0.0.1"
Expand All @@ -883,21 +884,6 @@ def getProps(self, process, current):
props["IceMX.Metrics.Parent.GroupBy"] = "parent"
props["IceMX.Metrics.All.GroupBy"] = "none"

#
# Speed up Windows testing. We override the connect timeout for some tests which are
# establishing connections to inactive ports. It takes around 1s for such connection
# establishment to fail on Windows.
#
# if isinstance(platform, Windows):
# if current.testsuite.getId().startswith("IceGrid") or \
# current.testsuite.getId() in ["Ice/binding",
# "Ice/location",
# "Ice/background",
# "Ice/faultTolerance",
# "Ice/services",
# "IceDiscovery/simple"]:
# props["Ice.Override.ConnectTimeout"] = "400"

# Additional properties specified on the command line with --cprops or --sprops
additionalProps = []
if self.cprops and isinstance(process, Client):
Expand Down
9 changes: 7 additions & 2 deletions scripts/tests/Ice/adapterDeactivation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
# Copyright (c) ZeroC, Inc. All rights reserved.
#

from Util import TestSuite
from Util import CSharpMapping, Darwin, TestSuite, platform, Mapping

options = {}
# Disable IPv6 for .NET on macOS until https://github.com/dotnet/runtime/pull/108334 is merged in .NET 8
# See https://github.com/zeroc-ice/ice/issues/2061
if (isinstance(Mapping.getByPath(__name__), CSharpMapping) and isinstance(platform, Darwin)):
options = {"ipv6": [False]}

TestSuite(__name__, multihost=False)
TestSuite(__name__, multihost=False, options=options)

0 comments on commit 2359372

Please sign in to comment.