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

[Bug Report] Wrong Unlock #336

Open
qingzhu521 opened this issue Aug 5, 2021 · 15 comments
Open

[Bug Report] Wrong Unlock #336

qingzhu521 opened this issue Aug 5, 2021 · 15 comments

Comments

@qingzhu521
Copy link

qingzhu521 commented Aug 5, 2021

if you try

            TrinityConfig.CurrentRunningMode = RunningMode.Client;
            try {
                KCoreCell node_ins = Global.CloudStorage.LoadKCoreCell(0);
            }
            catch (Exception ex) {
                Console.WriteLine("cell not found");
            }
            var neighbors = new List<long>();
            Global.CloudStorage.SaveKCoreCell(0, alive: false, remain_nodes: 0, neighbors);

this code the server will break this is for in

            #region LoadCell
            tupleList.Add(new TypeSyncRequestResponseHandlerTuple
            {
                Id = (ushort)RequestType.LoadCell,
                Handler = delegate(SynReqRspArgs args)
                {
                    int index, cellSize;
                    byte* cellPtr = null;
                    TrinityErrorCode eResult;
                    long cellId = *(long*)(args.Buffer + args.Offset);
                    if ((eResult = CLocalMemoryStorage.CGetLockedCellInfo4LoadCell(cellId, out cellSize, out cellPtr, out index)) == TrinityErrorCode.E_CELL_NOT_FOUND)
                    {
                        args.Response = new TrinityMessage(eResult);
                    }
                    else
                    {
                        args.Response = new TrinityMessage(eResult, cellSize);
                        Memory.memcpy(args.Response.Buffer + TrinityMessage.Offset, cellPtr, (ulong)cellSize);
                    }
                    Log.WriteLine(LogLevel.Info, "Load Crelease lock {0} id {1} index", cellId, index);
                    CLocalMemoryStorage.CReleaseCellLock(cellId, index);
                }
            });

The storage will release the lock. But in load process there don't exit any lock on the cell.

            uint8_t MTHash::ReleaseEntryLock(const int32_t index)
            {
                    if (TrinityConfig::ReadOnly())
                         return 0;
                   Trinity::Diagnostics::WriteLine(Trinity::Diagnostics::Info, "UnKnow Release index {0} LOCK {1}", index, (int)MTEntries[index].EntryLock);
                  return (MTEntries[index].EntryLock.fetch_add(-1, std::memory_order_release) - 1);
           }

this code will put the entrylock into -1.

@qingzhu521
Copy link
Author

image

The line 61 should be in 58 Bracket

@TaviTruman
Copy link
Contributor

@qingzhu521 Thanks for reporting this and sorry for this oversight; I will include a new unit-test case to sniff this out. I can't update this repo but I will update my forked repo and get the fix in this coming week. I'll also post where one can get the new Nuget packages.

@TaviTruman
Copy link
Contributor

@qingzhu521 I have a new fork of the Graph Engine here: https://github.com/InKnowWorks/IKW-GraphEngine. We have a lot of updates coming to address bugs, updated and additional documentation as well as new capabilities in the new year.

@TaviTruman
Copy link
Contributor

I'm testing a fix for this issue this week; I will keep you posted.

@shaobin
Copy link
Contributor

shaobin commented May 22, 2022

@qingzhu521 Thanks for reporting this! @TaviTruman , Thank you for trying to address this!

@qingzhu521 Could you help provide the minimal source code (with TSL etc.) that can reproduce this issue? I'd like to take a look at this issue.

@qingzhu521
Copy link
Author

Kcore.txt
GraphEng.txt
@shaobin There has been some time since this program, But I think this is the code. I try to implement KCore algorithm in Trinity which trigger this problem.

@shaobin
Copy link
Contributor

shaobin commented May 24, 2022

@qingzhu521 Thank you. I'll check out your code.

@TaviTruman
Copy link
Contributor

@shaobin Did we get time to review this in detail? I think I am running into the same problem.

@TaviTruman
Copy link
Contributor

@qingzhu521 Hi, did you ever get any type of resolution this your problem?

@qingzhu521
Copy link
Author

I think we can review this problem togather.

@qingzhu521
Copy link
Author

@TaviTruman I think is not hard to reproduce this problem. I just write a program that every time trinity can deal with a batch of data. Then the bug produced.

@TaviTruman
Copy link
Contributor

@qingzhu521 I have isolated the code template in the TSL Code Generator (C++). I will rebuild and test when I get a free hour or so. I'll also add a new test in the build.

@TaviTruman
Copy link
Contributor

@qingzhu521 Are you using the DataImporter?

@qingzhu521
Copy link
Author

yes

@TaviTruman
Copy link
Contributor

Cool. I have a number of fixes and updates. I don't think the Dataimporter is supported in the repo. Have you made any updates to the utility. I'm working to prepare a PR for this repo UT have already updated my forked repo copy.

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

No branches or pull requests

3 participants