This repository has been archived by the owner on Feb 20, 2024. It is now read-only.
Empty buffer for cid XX while expected SDUs were YY runtime error in multiple D2D application usecase #65
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In one of my simulations I encountered a problem where the above mentioned exception is
triggered here about 30 minutes into my simulation. Setup:
*.lteNic.phy.dynamicCellAssociation = true
**.lteNic.phy.enableHandover = true
The node in question is created out of range of any eNB and thus cannot transmit.
This also needs PR #64 to work. During this time the applications create messages
which will be queued in the RLC Layer, each within a dedicated connection.
In the Mac layer the MacBuffers accepts the
LteRlcPduNewData
as expected. When thenode enters TX/RX range with a eNB scheduling grants are received and the Mac layer
starts the scheduling (LcgScheduler) as expected. Due to the full Buffers only one
of the connections is scheduled leading to scheduleList that looks something like this:
All
availableBytes
are given to a single connection id. Note that theavailableBytes
must include theMAC_HEADER
(once) and theRLC_HEADER
(for each cid). After scheduling the Mac layer callsLteMacUe::macSduRequest() to create
LteMacSduRequests
for eachconnection currently available. This includes all connection even if the did
not receive any available bytes. In line 183 the scheduleList is iterated,
creating the
LteMacSduRequests
as mentioned. From the first Sdu the schedulednumber of bytes is reduced by the MAC_HEADER (here). However, in my case
the first item in the iterator didn't get allocated any bytes, leading to a
negative number of bytes for this SDU. This does not create an error because
the sduSize is of the type unsigned int (underflow) and the RLC layer code will
cast it to and int later on and ignores the request (see here).
This however means that for
cid 73990147
2 Bytes more are requested than actuallyneeded. This will lead to difference between the RLC Buffer length and the
MacBuffer length which should be synchronized. The RLC Buffer will run out of
data but the MacBuffer still has data which will be scheduled but no data will
be send down from the RLC layer, leading to the mentions exception. This error
will only occur if multiple connections exist, only one of them is served and
if the iterators in
LteMacUe::macSduRequest()
and in theLcgScheduler
havedifferent order allowing an empty
LteMacSduRequest
to be the first SDU.To reproduce the error create a breakpoint here with an condition of
sduSize <= 0
. In this case the MAC_HEADER is not removed correctly and forsome other connection to many bytes are requested from the RLC layer leading to
an offset between the RLC and LteMacBuffer.
In the pull request I fixed the issue by directly specifying which connection
provides the first SDU so the MAC_HEADER is removed from the correct
connection. Another approach would be to give the scheduler the correct amount
of
availabeBytes
where the MAC_HEADER is already removed. However I am notsure if this breaks something else I am not aware of.