Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT - SIP on Netty #19310

Closed
wants to merge 3 commits into from
Closed

DRAFT - SIP on Netty #19310

wants to merge 3 commits into from

Conversation

wtlucy
Copy link
Contributor

@wtlucy wtlucy commented Nov 10, 2021

For #15779

High Level Changes:

  • sipcontainer classes relying on the channel framework have been reimplemented on top of Netty
    • WsByteBuffer replaced for[by] ByteBuf
    • Channel Framework service and APIs replaced by Liberty Netty framework io.openliberty.netty.NettyFramework and io.netty.* APIs
    • classes previously relying on channel framework functionality have been moved into new packages *.chfw.*
      • e.g. com/ibm/ws/sip/channel/resolver/dns/impl/Dns.java -> com/ibm/ws/sip/channel/resolver/dns/impl/chfw/Dns.java
      • new Netty implementations are in *.netty.* packages, e.g. com/ibm/ws/sip/channel/resolver/dns/impl/netty/Dns.java
    • a new server.xml config element <sipContainer useNettyTransport="true/false"> has been added, which toggles between the chfw and netty implementations
    • A few improvements needed to be made to the Liberty Netty framework:
      • support for outbound connection creation via NettyFramework.startOutbound()
      • TLS support via a new io.openliberty.netty.internal.tls.impl
        • this bundle provides a new service NettyTlsProvider, which provides APIs to build a io.netty.handler.ssl.SslContext from the active Liberty TLS configs, via com.ibm.websphere.ssl.JSSEHelper.
        • The SslContext can then be used to create Netty SslHandler

Detailed SIP component changes

DNS resolver (domainResolver)

  • Netty changes mostly contianed to com.ibm.ws.sip.channel.resolver.dns.impl.netty and com.ibm.ws.sip.channel.resolver.impl.netty
    • com.ibm.ws.sip.channel.resolver.dns.impl.netty largely contains WsByteBuffer -> ByteBuf changes
    • com.ibm.ws.sip.channel.resolver.impl.netty makes outbound TCP and UDP requests via SipResolverTcpTransport and SipResolverUdpTransport
      • those impls use NettyFramework to create their outbound connection bootstraps, and then NettyFramework.startOutbound() to start and register the connections
      • each impl provides a ChannelInitializerWrapper which sets up their pipelines - in both cases including a SimpleChannelInboundHandler which is used to pass new data to the correct methods
  • selection between chfw and Netty implementations occurs in com.ibm.ws.sip.container.resolver.DomainResolverImpl.getSipURILookup(SipURILookupCallbackImpl, SIPUri) and com.ibm.ws.sip.container.resolver.DomainResolverImpl.init()

SIP Endpoint (sipEndpoint)

  • Netty changes split between com.ibm.ws.sip.stack.transport.netty and com.ibm.ws.sip.stack.transport.sip.netty
  • com.ibm.ws.sip.stack.transport refactored rather than split completely (this might want to be revisited)
  • com.ibm.ws.sip.stack.transport.GenericEndpointImpl is the @Component which registers and manages endpoints
    • Netty and chfw impls are determined in activate()
    • previous chfw chain start logic is largely reused by Netty impl, including naming and config props
    • endpoints started via GenericTCPChain and GenericUDPChain update()
      • bootstraps created by passing endpoint config to NettyFramework.create*Bootstrap()
      • registered and started via NettyFramework.start()
      • TLS endpoints covered by GenericTCPChain, and implemented by adding a io.netty.handler.ssl.SslHandler.SslHandler to the head of the ChannelInitializer pipeline

SIP Endpoint (sipEndpoint)

  • Netty changes split between com.ibm.ws.sip.stack.transport.netty and com.ibm.ws.sip.stack.transport.sip.netty
  • com.ibm.ws.sip.stack.transport refactored rather than split completely (this might want to be revisited)
  • com.ibm.ws.sip.stack.transport.GenericEndpointImpl is the @Component which registers and manages endpoints
    • Netty and chfw impls are determined in activate()
    • previous chfw chain start logic is largely reused by Netty impl, including naming and config props
    • endpoints started via GenericTCPChain and GenericUDPChain update()
      • bootstraps created by passing endpoint config to NettyFramework.create*Bootstrap()
      • registered and started via NettyFramework.start()
      • TLS endpoints covered by GenericTCPChain, and implemented by adding a io.netty.handler.ssl.SslHandler.SslHandler to the head of the ChannelInitializer pipeline
  • SipOutboundConnLink used for outbound connections
    • chfw and Netty impls swapped via com.ibm.ws.sip.stack.transaction.transport.SIPConnectionsModel.initSupportedTransports()

Remaining work

  • the packaging of these changes likely needs to be re-thought. Currently this PR results in new bundles being added to the runtime by a GA feature, which is the desired end result but is probably not OK for this type of code.
  • com.ibm.ws.sip.stack.transport.sip.netty.SipOutboundConnLink should be updated to use NettyFramework APIs to create a bootstrap and connect.

@LibbyBot
Copy link

Code analysis and actions

DO NOT DELETE THIS COMMENT.
  • 76 product code files were changed.
  • Please describe in a separate comment how you tested your changes.

@wtlucy wtlucy self-assigned this Nov 10, 2021
@wtlucy wtlucy force-pushed the netty_sip branch 3 times, most recently from 2169774 to 0ee0c0c Compare November 29, 2021 20:07
@wtlucy
Copy link
Contributor Author

wtlucy commented Nov 29, 2021

#build #spawn.fullfat.buckets=com.ibm.ws.sipcontainer_fat

@LibbyBot
Copy link

Please code review feature-related files, @OpenLiberty/delivery-approvers

@LibbyBot
Copy link

Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_WAivsFFfEeysneUx1bJGow

Target locations of links might be accessible only to IBM employees.

@LibbyBot
Copy link

The build wtlucy-19310-20211129-1504
https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_WAivsFFfEeysneUx1bJGow
completed successfully!

@wtlucy
Copy link
Contributor Author

wtlucy commented Nov 30, 2021

#build #spawn.fullfat.buckets=com.ibm.ws.sipcontainer_fat

@LibbyBot
Copy link

Please code review feature-related files, @OpenLiberty/delivery-approvers

@LibbyBot
Copy link

Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_B5efQFIZEeysneUx1bJGow

Target locations of links might be accessible only to IBM employees.

@wtlucy
Copy link
Contributor Author

wtlucy commented Dec 1, 2021

#build #spawn.fullfat.buckets=com.ibm.ws.sipcontainer_fat

@LibbyBot
Copy link

LibbyBot commented Dec 1, 2021

Please code review feature-related files, @OpenLiberty/delivery-approvers

@LibbyBot
Copy link

LibbyBot commented Dec 1, 2021

Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_9TTVkFLtEeysneUx1bJGow

Target locations of links might be accessible only to IBM employees.

@wtlucy
Copy link
Contributor Author

wtlucy commented Dec 2, 2021

#build #spawn.fullfat.buckets=com.ibm.ws.sipcontainer_fat

@LibbyBot
Copy link

LibbyBot commented Dec 2, 2021

Please code review feature-related files, @OpenLiberty/delivery-approvers

@LibbyBot
Copy link

LibbyBot commented Dec 2, 2021

Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_zmROgFO8EeysneUx1bJGow

Target locations of links might be accessible only to IBM employees.

@LibbyBot
Copy link

LibbyBot commented Dec 3, 2021

The build wtlucy-19310-20211202-1912
https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_zmROgFO8EeysneUx1bJGow
completed and has errors or failures.

For help analyzing your personal build, go to https://cognitive.hursley.ibm.com/buildAnalysis.html?uuid=_zmROgFO8EeysneUx1bJGow

@wtlucy
Copy link
Contributor Author

wtlucy commented Dec 6, 2021

#build #spawn.fullfat.buckets=com.ibm.ws.sipcontainer_fat

@LibbyBot
Copy link

LibbyBot commented Dec 6, 2021

Please code review feature-related files, @OpenLiberty/delivery-approvers

@LibbyBot
Copy link

LibbyBot commented Dec 6, 2021

Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_vSvU0FbSEeyWaZwSyDrk3A

Target locations of links might be accessible only to IBM employees.

@LibbyBot
Copy link

LibbyBot commented Dec 7, 2021

The build wtlucy-19310-20211206-1334
https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_vSvU0FbSEeyWaZwSyDrk3A
completed and has errors or failures.

For help analyzing your personal build, go to https://cognitive.hursley.ibm.com/buildAnalysis.html?uuid=_vSvU0FbSEeyWaZwSyDrk3A

@wtlucy
Copy link
Contributor Author

wtlucy commented Dec 8, 2021

#build #spawn.fullfat.buckets=com.ibm.ws.sipcontainer_fat

@LibbyBot
Copy link

LibbyBot commented Dec 8, 2021

Please code review feature-related files, @OpenLiberty/delivery-approvers

@LibbyBot
Copy link

LibbyBot commented Dec 8, 2021

Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_swoXwFhvEeyWaZwSyDrk3A

Target locations of links might be accessible only to IBM employees.

@LibbyBot
Copy link

LibbyBot commented Dec 9, 2021

The build wtlucy-19310-20211208-1448
https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_swoXwFhvEeyWaZwSyDrk3A
completed and has errors or failures.

For help analyzing your personal build, go to https://cognitive.hursley.ibm.com/buildAnalysis.html?uuid=_swoXwFhvEeyWaZwSyDrk3A

@LibbyBot
Copy link

Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_VN_IcF0zEeySV8PQupfSfg

Target locations of links might be accessible only to IBM employees.

@LibbyBot
Copy link

The build wtlucy-19310-20211214-1619
https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_VN_IcF0zEeySV8PQupfSfg
completed and has errors or failures.

For help analyzing your personal build, go to https://cognitive.hursley.ibm.com/buildAnalysis.html?uuid=_VN_IcF0zEeySV8PQupfSfg

@wtlucy
Copy link
Contributor Author

wtlucy commented Dec 15, 2021

#build #spawn.fullfat.buckets=com.ibm.ws.sipcontainer_fat

@LibbyBot
Copy link

Please code review feature-related files, @OpenLiberty/delivery-approvers

@LibbyBot
Copy link

Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_36_aUF30EeySV8PQupfSfg

Target locations of links might be accessible only to IBM employees.

@wtlucy
Copy link
Contributor Author

wtlucy commented Dec 17, 2021

#build #spawn.fullfat.buckets=com.ibm.ws.sipcontainer_fat

@LibbyBot
Copy link

Please code review feature-related files, @OpenLiberty/delivery-approvers

@LibbyBot
Copy link

Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_DTnyQF9wEeySV8PQupfSfg

Target locations of links might be accessible only to IBM employees.

@LibbyBot
Copy link

The build wtlucy-19310-20211217-1541
https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_DTnyQF9wEeySV8PQupfSfg
completed and has errors or failures.

For help analyzing your personal build, go to https://cognitive.hursley.ibm.com/buildAnalysis.html?uuid=_DTnyQF9wEeySV8PQupfSfg

@wtlucy
Copy link
Contributor Author

wtlucy commented Dec 20, 2021

#build #spawn.fullfat.buckets=com.ibm.ws.sipcontainer_fat

@LibbyBot
Copy link

Please code review feature-related files, @OpenLiberty/delivery-approvers

@LibbyBot
Copy link

Your personal build request is at https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_PpqDMGHTEeywTM1lnhUXVw

Target locations of links might be accessible only to IBM employees.

@LibbyBot
Copy link

The build wtlucy-19310-20211220-1334
https://wasrtc.hursley.ibm.com:9443/jazz/resource/itemOid/com.ibm.team.build.BuildResult/_PpqDMGHTEeywTM1lnhUXVw
completed and has errors or failures.

For help analyzing your personal build, go to https://cognitive.hursley.ibm.com/buildAnalysis.html?uuid=_PpqDMGHTEeywTM1lnhUXVw

@wtlucy
Copy link
Contributor Author

wtlucy commented Dec 21, 2021

The latest build has finally completely passed the sipcontainer_fat bucket!
image


_bufferArray[0] = _lengthBuffer;
_bufferArray[1] = requestBuffer;
ByteBuf newBuf = Unpooled.copiedBuffer(_bufferArray);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bill, was there a glitch with the composite buffer below that was solved by using an unpooled copied buffer above?

@@ -166,6 +172,9 @@ protected void modified(Map<String, Object> properties) {
if (c_logger.isTraceDebugEnabled())
c_logger.traceDebug("SipContainerComponent modified", properties);
PropertiesStore.getInstance().getProperties().updateProperties(properties);
useNetty = MetatypeUtils.parseBoolean(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

SipResolverService.initialize(dsProps,m_chfw);

_useNetty = SipContainerComponent.useNetty();
if (_useNetty) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does '_' prefix mean in this context?

@isaacrivriv
Copy link
Member

Closing in favor of #24890

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants