-
Notifications
You must be signed in to change notification settings - Fork 748
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
IPC not working between .net7 and .net461 #1080
Comments
I found the reason behind. NetMQ>Core>Transports>Ipc>IpcAddress.cs Resolve function which converts pipeName into port number, uses string.GetHashCode() function which is supposed to return same number every time you run it. However at .NET7 property "HashHelpers.s_UseRandomizedStringHashing" is set to true and string.GetHashCode() function returns a random number which causes port number to be wrong. |
Hi Ahmeteminsahingoz, just had the same problem, ipc - went from 4.8 to 8; I understand the issue as you've explained, but what was your ultimate solution? |
There is a function in netmq library that generates integer from string. Im
outside rightnow and can not check but the function is named getHashCode()
if a remeber correctly. In .net4.6 it generates same integer for every run
however in .net7 it generates random integer. I downloaded the netmq
repository from github added a new function named
getHashCodeLegacyFramewor() and changed the code so that netmq uses that
function. If you can not find it contact me again and I will share the code
block with you when im available
6 Ara 2024 Cum, saat 21:34 tarihinde EDouglas-Alamo <
***@***.***> şunu yazdı:
… Hi Ahmeteminsahingoz, just had the same problem, ipc - went from 4.8 to 8;
I understand the issue as you've explained, but what was your ultimate
solution?
—
Reply to this email directly, view it on GitHub
<#1080 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AP44PDBWKJ6D6BXDWRBPGBD2EHU3DAVCNFSM6AAAAABTFGFTCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRTHEZDENRTGA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Wow, thank you the quick response!
Very much appreciate the option to reach back out to you should I be unable to find it.
Best Regards,
Eric
From: ahmeteminsahingoz ***@***.***>
Sent: Friday, December 6, 2024 12:41 PM
To: zeromq/netmq ***@***.***>
Cc: Eric Douglas ***@***.***>; Comment ***@***.***>
Subject: Re: [zeromq/netmq] IPC not working between .net7 and .net461 (Issue #1080)
There is a function in netmq library that generates integer from string. Im
outside rightnow and can not check but the function is named getHashCode()
if a remeber correctly. In .net4.6 it generates same integer for every run
however in .net7 it generates random integer. I downloaded the netmq
repository from github added a new function named
getHashCodeLegacyFramewor() and changed the code so that netmq uses that
function. If you can not find it contact me again and I will share the code
block with you when im available
6 Ara 2024 Cum, saat 21:34 tarihinde EDouglas-Alamo <
***@***.***> şunu yazdı:
Hi Ahmeteminsahingoz, just had the same problem, ipc - went from 4.8 to 8;
I understand the issue as you've explained, but what was your ultimate
solution?
—
Reply to this email directly, view it on GitHub
<#1080 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AP44PDBWKJ6D6BXDWRBPGBD2EHU3DAVCNFSM6AAAAABTFGFTCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRTHEZDENRTGA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
—
Reply to this email directly, view it on GitHub<#1080 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A7UMINCJNJGKKJLEFZIRX232EHVTRAVCNFSM6AAAAABTFGFTCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRTHEZTGMJWGM>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Found the code, reference below, and would appreciate the code block you mentioned – whenever you get a chance….
using System.Diagnostics.CodeAnalysis;
using System.Net;
namespace NetMQ.Core.Transports.Ipc
{
internal class IpcAddress : Address.IZAddress
{
private string? m_name;
public override string ToString()
{
if (m_name == null)
return string.Empty;
return Protocol + "://" + m_name;
}
public void Resolve(string name, bool ip4Only)
{
m_name = name;
int hash = name.GetHashCode();
if (hash < 0)
hash = -hash;
hash = hash%55536;
hash += 10000;
this.Address = new IPEndPoint(IPAddress.Loopback, hash);
}
[DisallowNull]
public IPEndPoint? Address { get; private set; }
public string Protocol => Core.Address.IpcProtocol;
}
}
From: ahmeteminsahingoz ***@***.***>
Sent: Friday, December 6, 2024 12:41 PM
To: zeromq/netmq ***@***.***>
Cc: Eric Douglas ***@***.***>; Comment ***@***.***>
Subject: Re: [zeromq/netmq] IPC not working between .net7 and .net461 (Issue #1080)
There is a function in netmq library that generates integer from string. Im
outside rightnow and can not check but the function is named getHashCode()
if a remeber correctly. In .net4.6 it generates same integer for every run
however in .net7 it generates random integer. I downloaded the netmq
repository from github added a new function named
getHashCodeLegacyFramewor() and changed the code so that netmq uses that
function. If you can not find it contact me again and I will share the code
block with you when im available
6 Ara 2024 Cum, saat 21:34 tarihinde EDouglas-Alamo <
***@***.***> şunu yazdı:
Hi Ahmeteminsahingoz, just had the same problem, ipc - went from 4.8 to 8;
I understand the issue as you've explained, but what was your ultimate
solution?
—
Reply to this email directly, view it on GitHub
<#1080 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AP44PDBWKJ6D6BXDWRBPGBD2EHU3DAVCNFSM6AAAAABTFGFTCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRTHEZDENRTGA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
—
Reply to this email directly, view it on GitHub<#1080 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A7UMINCJNJGKKJLEFZIRX232EHVTRAVCNFSM6AAAAABTFGFTCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRTHEZTGMJWGM>.
You are receiving this because you commented.Message ID: ***@***.***>
|
[image: image.png]
EDouglas-Alamo ***@***.***>, 6 Ara 2024 Cum, 22:52 tarihinde
şunu yazdı:
… Found the code, reference below, and would appreciate the code block you
mentioned – whenever you get a chance….
using System.Diagnostics.CodeAnalysis;
using System.Net;
namespace NetMQ.Core.Transports.Ipc
{
internal class IpcAddress : Address.IZAddress
{
private string? m_name;
public override string ToString()
{
if (m_name == null)
return string.Empty;
return Protocol + "://" + m_name;
}
public void Resolve(string name, bool ip4Only)
{
m_name = name;
int hash = name.GetHashCode();
if (hash < 0)
hash = -hash;
hash = hash%55536;
hash += 10000;
this.Address = new IPEndPoint(IPAddress.Loopback, hash);
}
[DisallowNull]
public IPEndPoint? Address { get; private set; }
public string Protocol => Core.Address.IpcProtocol;
}
}
From: ahmeteminsahingoz ***@***.***>
Sent: Friday, December 6, 2024 12:41 PM
To: zeromq/netmq ***@***.***>
Cc: Eric Douglas ***@***.***>; Comment ***@***.***>
Subject: Re: [zeromq/netmq] IPC not working between .net7 and .net461
(Issue #1080)
There is a function in netmq library that generates integer from string.
Im
outside rightnow and can not check but the function is named getHashCode()
if a remeber correctly. In .net4.6 it generates same integer for every run
however in .net7 it generates random integer. I downloaded the netmq
repository from github added a new function named
getHashCodeLegacyFramewor() and changed the code so that netmq uses that
function. If you can not find it contact me again and I will share the
code
block with you when im available
6 Ara 2024 Cum, saat 21:34 tarihinde EDouglas-Alamo <
***@***.***> şunu yazdı:
> Hi Ahmeteminsahingoz, just had the same problem, ipc - went from 4.8 to
8;
> I understand the issue as you've explained, but what was your ultimate
> solution?
>
> —
> Reply to this email directly, view it on GitHub
> <#1080 (comment)>,
or
> unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AP44PDBWKJ6D6BXDWRBPGBD2EHU3DAVCNFSM6AAAAABTFGFTCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRTHEZDENRTGA>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
—
Reply to this email directly, view it on GitHub<
#1080 (comment)>, or
unsubscribe<
https://github.com/notifications/unsubscribe-auth/A7UMINCJNJGKKJLEFZIRX232EHVTRAVCNFSM6AAAAABTFGFTCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRTHEZTGMJWGM>.
You are receiving this because you commented.Message ID: ***@***.***>
—
Reply to this email directly, view it on GitHub
<#1080 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AP44PDFJVAPPI3Y3MXGKI432EH565AVCNFSM6AAAAABTFGFTCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRUGA2DIOBQGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
[image: image.png]
this function is defined in string extensions already but the function is
declared internal that is why I copied the function
Emin Sahingoz ***@***.***>, 7 Ara 2024 Cmt, 11:41 tarihinde
şunu yazdı:
… [image: image.png]
EDouglas-Alamo ***@***.***>, 6 Ara 2024 Cum, 22:52
tarihinde şunu yazdı:
> Found the code, reference below, and would appreciate the code block you
> mentioned – whenever you get a chance….
>
>
> using System.Diagnostics.CodeAnalysis;
> using System.Net;
> namespace NetMQ.Core.Transports.Ipc
> {
> internal class IpcAddress : Address.IZAddress
> {
> private string? m_name;
> public override string ToString()
> {
> if (m_name == null)
> return string.Empty;
> return Protocol + "://" + m_name;
> }
> public void Resolve(string name, bool ip4Only)
> {
> m_name = name;
> int hash = name.GetHashCode();
> if (hash < 0)
> hash = -hash;
> hash = hash%55536;
> hash += 10000;
> this.Address = new IPEndPoint(IPAddress.Loopback, hash);
> }
> [DisallowNull]
> public IPEndPoint? Address { get; private set; }
> public string Protocol => Core.Address.IpcProtocol;
> }
> }
>
> From: ahmeteminsahingoz ***@***.***>
> Sent: Friday, December 6, 2024 12:41 PM
> To: zeromq/netmq ***@***.***>
> Cc: Eric Douglas ***@***.***>; Comment ***@***.***>
> Subject: Re: [zeromq/netmq] IPC not working between .net7 and .net461
> (Issue #1080)
>
> There is a function in netmq library that generates integer from string.
> Im
> outside rightnow and can not check but the function is named
> getHashCode()
> if a remeber correctly. In .net4.6 it generates same integer for every
> run
> however in .net7 it generates random integer. I downloaded the netmq
> repository from github added a new function named
> getHashCodeLegacyFramewor() and changed the code so that netmq uses that
> function. If you can not find it contact me again and I will share the
> code
> block with you when im available
>
> 6 Ara 2024 Cum, saat 21:34 tarihinde EDouglas-Alamo <
> ***@***.***> şunu yazdı:
>
> > Hi Ahmeteminsahingoz, just had the same problem, ipc - went from 4.8 to
> 8;
> > I understand the issue as you've explained, but what was your ultimate
> > solution?
> >
> > —
> > Reply to this email directly, view it on GitHub
> > <#1080 (comment)>,
> or
> > unsubscribe
> > <
> https://github.com/notifications/unsubscribe-auth/AP44PDBWKJ6D6BXDWRBPGBD2EHU3DAVCNFSM6AAAAABTFGFTCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRTHEZDENRTGA>
>
> > .
> > You are receiving this because you authored the thread.Message ID:
> > ***@***.***>
> >
>
>
> —
> Reply to this email directly, view it on GitHub<
> #1080 (comment)>, or
> unsubscribe<
> https://github.com/notifications/unsubscribe-auth/A7UMINCJNJGKKJLEFZIRX232EHVTRAVCNFSM6AAAAABTFGFTCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRTHEZTGMJWGM>.
>
> You are receiving this because you commented.Message ID: ***@***.***>
>
> —
> Reply to this email directly, view it on GitHub
> <#1080 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AP44PDFJVAPPI3Y3MXGKI432EH565AVCNFSM6AAAAABTFGFTCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRUGA2DIOBQGM>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
|
Thank you! Apologies for the late reply, I have been out of the office.
Development Protocol prohibits modification of 3rd-party libraries and I did have success using tcp with .NET 8.
While it is hitting a tcp local port, it is on the same machine and there should not be any significant network latency, but I would still prefer ipc.
Do you know if your fix will become available in a future official release ?
Again, appreciate your time and help working through this process to a successful conclusion.
Best Regards,
Eric
From: ahmeteminsahingoz ***@***.***>
Sent: Saturday, December 7, 2024 2:50 AM
To: zeromq/netmq ***@***.***>
Cc: Eric Douglas ***@***.***>; Comment ***@***.***>
Subject: Re: [zeromq/netmq] IPC not working between .net7 and .net461 (Issue #1080)
[image: image.png]
this function is defined in string extensions already but the function is
declared internal that is why I copied the function
Emin Sahingoz ***@***.***>, 7 Ara 2024 Cmt, 11:41 tarihinde
şunu yazdı:
[image: image.png]
EDouglas-Alamo ***@***.***>, 6 Ara 2024 Cum, 22:52
tarihinde şunu yazdı:
> Found the code, reference below, and would appreciate the code block you
> mentioned – whenever you get a chance….
>
>
> using System.Diagnostics.CodeAnalysis;
> using System.Net;
> namespace NetMQ.Core.Transports.Ipc
> {
> internal class IpcAddress : Address.IZAddress
> {
> private string? m_name;
> public override string ToString()
> {
> if (m_name == null)
> return string.Empty;
> return Protocol + "://" + m_name;
> }
> public void Resolve(string name, bool ip4Only)
> {
> m_name = name;
> int hash = name.GetHashCode();
> if (hash < 0)
> hash = -hash;
> hash = hash%55536;
> hash += 10000;
> this.Address = new IPEndPoint(IPAddress.Loopback, hash);
> }
> [DisallowNull]
> public IPEndPoint? Address { get; private set; }
> public string Protocol => Core.Address.IpcProtocol;
> }
> }
>
> From: ahmeteminsahingoz ***@***.***>
> Sent: Friday, December 6, 2024 12:41 PM
> To: zeromq/netmq ***@***.***>
> Cc: Eric Douglas ***@***.***>; Comment ***@***.***>
> Subject: Re: [zeromq/netmq] IPC not working between .net7 and .net461
> (Issue #1080)
>
> There is a function in netmq library that generates integer from string.
> Im
> outside rightnow and can not check but the function is named
> getHashCode()
> if a remeber correctly. In .net4.6 it generates same integer for every
> run
> however in .net7 it generates random integer. I downloaded the netmq
> repository from github added a new function named
> getHashCodeLegacyFramewor() and changed the code so that netmq uses that
> function. If you can not find it contact me again and I will share the
> code
> block with you when im available
>
> 6 Ara 2024 Cum, saat 21:34 tarihinde EDouglas-Alamo <
> ***@***.***> şunu yazdı:
>
> > Hi Ahmeteminsahingoz, just had the same problem, ipc - went from 4.8 to
> 8;
> > I understand the issue as you've explained, but what was your ultimate
> > solution?
> >
> > —
> > Reply to this email directly, view it on GitHub
> > <#1080 (comment)>,
> or
> > unsubscribe
> > <
> https://github.com/notifications/unsubscribe-auth/AP44PDBWKJ6D6BXDWRBPGBD2EHU3DAVCNFSM6AAAAABTFGFTCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRTHEZDENRTGA>
>
> > .
> > You are receiving this because you authored the thread.Message ID:
> > ***@***.***>
> >
>
>
> —
> Reply to this email directly, view it on GitHub<
> #1080 (comment)>, or
> unsubscribe<
> https://github.com/notifications/unsubscribe-auth/A7UMINCJNJGKKJLEFZIRX232EHVTRAVCNFSM6AAAAABTFGFTCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRTHEZTGMJWGM>.
>
> You are receiving this because you commented.Message ID: ***@***.***>
>
> —
> Reply to this email directly, view it on GitHub
> <#1080 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AP44PDFJVAPPI3Y3MXGKI432EH565AVCNFSM6AAAAABTFGFTCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRUGA2DIOBQGM>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
—
Reply to this email directly, view it on GitHub<#1080 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A7UMINC3IIZLPHYFIBPIW4L2EKZCFAVCNFSM6AAAAABTFGFTCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMRVGAZTIOJXGY>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Environment
Expected behaviour
Only difference between working and not working instances is that framework version is changed from net461 to .NET7
Actual behaviour
I upgraded one of my project into .NET7 from net461 and when im trying to send tcp message to net461 applications it works fine, however for IPC communication my messages are not received by net461 application. I tried to upgrade receiving side application to .NET7 as well but problem remains. I checked the encoding differences but there seems no problem since default is set in netmq library, not from .net sources. What might be the possible reason for this problem, I will be glad if you give me some clues
Steps to reproduce the behaviour
Sending message to net461 console application from .NET7 console application using IPC channel.
The text was updated successfully, but these errors were encountered: